nsIPlugin and nsIPluginHost should not inherit from nsIFactory. b=502886 r/sr=jst

This commit is contained in:
Josh Aas 2009-07-07 21:00:11 -04:00
parent 0263e6b4ac
commit f6ab658dab
7 changed files with 28 additions and 69 deletions

View File

@ -35,32 +35,27 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIFactory.idl"
#include "nsISupports.idl"
#include "nspluginroot.idl"
%{C++
#include "nsplugindefs.h"
// {ffc63200-cf09-11d2-a5a0-bc8f7ad21dfc}
#define NS_PLUGIN_CID \
{ 0xffc63200, 0xcf09, 0x11d2, { 0xa5, 0xa0, 0xbc, 0x8f, 0x7a, 0xd2, 0x1d, 0xfc } }
// Prefix for ContractID of all plugins
#define NS_INLINE_PLUGIN_CONTRACTID_PREFIX "@mozilla.org/inline-plugin/"
#define MOZ_PLUGIN_CONTRACTID \
"@mozilla.org/plugin/plugin;1"
%}
[uuid(df773070-0199-11d2-815b-006008119d7a)]
interface nsIPlugin : nsIFactory
interface nsIPluginInstance;
[uuid(0937FB08-16E8-4365-BABF-88E09E4E33A4)]
interface nsIPlugin : nsISupports
{
/**
* Creates a new plugin instance, based on a MIME type. This
* allows different impelementations to be created depending on
* the specified MIME type.
*/
void createPluginInstance(in nsISupports aOuter,
in nsIIDRef aIID,
in string aPluginMIMEType,
[retval, iid_is(aIID)] out nsQIResult aResult);
void createPluginInstance(out nsIPluginInstance aResult);
/**
* Initializes the plugin and will be called before any new instances are

View File

@ -36,7 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nspluginroot.idl"
#include "nsIFactory.idl"
#include "nsISupports.idl"
#include "nsIPluginInstanceOwner.idl"
#include "nsIStreamListener.idl"
#include "nsIStringStream.idl"
@ -65,8 +65,8 @@ interface nsIPluginStreamListener;
[ref] native nsIStreamListenerRef(nsIStreamListener *);
[ptr] native nsPluginNativeWindowPtr(nsPluginNativeWindow);
[scriptable, uuid(A2D6DC70-7456-4422-A9F6-D96F46868C0B)]
interface nsIPluginHost : nsIFactory
[scriptable, uuid(23E8FD98-A625-4B08-BE1A-F7CC18A5B106)]
interface nsIPluginHost : nsISupports
{
[noscript] void init();
@ -83,7 +83,7 @@ interface nsIPluginHost : nsIFactory
*/
void reloadPlugins(in boolean reloadPages);
[noscript] nsIPlugin getPluginFactory(in string aMimeType);
[noscript] nsIPlugin getPlugin(in string aMimeType);
[noscript] void instantiateEmbeddedPlugin(in string aMimeType, in nsIURI aURL, in nsIPluginInstanceOwner aOwner);

View File

@ -39,7 +39,7 @@
#define nsPluginsCID_h_
#define NS_PLUGIN_HOST_CID \
{ 0xA2D6DC70, 0x7456, 0x4422, \
{ 0xA9, 0xF6, 0xD9, 0x6F, 0x46, 0x86, 0x8C, 0x0B } }
{ 0x23E8FD98, 0xA625, 0x4B08, \
{ 0xBE, 0x1A, 0xF7, 0xCC, 0x18, 0xA5, 0xB1, 0x06 } }
#endif // nsPluginsCID_h_

View File

@ -264,7 +264,7 @@ nsNPAPIPlugin::CheckClassInitialized(void)
NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,("NPN callbacks initialized\n"));
}
NS_IMPL_ISUPPORTS2(nsNPAPIPlugin, nsIPlugin, nsIFactory)
NS_IMPL_ISUPPORTS1(nsNPAPIPlugin, nsIPlugin)
nsNPAPIPlugin::nsNPAPIPlugin(NPPluginFuncs* callbacks, PRLibrary* aLibrary,
NP_PLUGINSHUTDOWN aShutdown)
@ -576,9 +576,8 @@ nsNPAPIPlugin::CreatePlugin(const char* aFilePath, PRLibrary* aLibrary,
return NS_OK;
}
nsresult
nsNPAPIPlugin::CreateInstance(nsISupports *aOuter, const nsIID &aIID,
void **aResult)
NS_METHOD
nsNPAPIPlugin::CreatePluginInstance(nsIPluginInstance **aResult)
{
if (!aResult)
return NS_ERROR_NULL_POINTER;
@ -587,27 +586,14 @@ nsNPAPIPlugin::CreateInstance(nsISupports *aOuter, const nsIID &aIID,
nsRefPtr<nsNPAPIPluginInstance> inst =
new nsNPAPIPluginInstance(&fCallbacks, fLibrary);
if (!inst)
return NS_ERROR_OUT_OF_MEMORY;
return inst->QueryInterface(aIID, aResult);
}
nsresult
nsNPAPIPlugin::LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
NS_ADDREF(inst);
*aResult = static_cast<nsIPluginInstance*>(inst);
return NS_OK;
}
NS_METHOD
nsNPAPIPlugin::CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID,
const char *aPluginMIMEType, void **aResult)
{
return CreateInstance(aOuter, aIID, aResult);
}
nsresult
nsNPAPIPlugin::Initialize(void)
{

View File

@ -38,7 +38,6 @@
#ifndef nsNPAPIPlugin_h_
#define nsNPAPIPlugin_h_
#include "nsIFactory.h"
#include "nsIPlugin.h"
#include "prlink.h"
#include "npfunctions.h"
@ -80,7 +79,6 @@ public:
virtual ~nsNPAPIPlugin(void);
NS_DECL_ISUPPORTS
NS_DECL_NSIFACTORY
NS_DECL_NSIPLUGIN
// Constructs and initializes an nsNPAPIPlugin object. A NULL file path

View File

@ -181,9 +181,6 @@ static const char *kPluginRegistryVersion = "0.11";
// The minimum registry version we know how to read
static const char *kMinimumRegistryVersion = "0.9";
// CID's && IID's
static NS_DEFINE_IID(kIPluginInstanceIID, NS_IPLUGININSTANCE_IID);
static NS_DEFINE_CID(kPluginCID, NS_PLUGIN_CID);
static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
static const char kDirectoryServiceContractID[] = "@mozilla.org/file/directory_service;1";
@ -2934,20 +2931,6 @@ NS_IMETHODIMP nsPluginHost::FindProxyForURL(const char* url, char* *result)
return res;
}
NS_IMETHODIMP nsPluginHost::CreateInstance(nsISupports *aOuter,
REFNSIID aIID,
void **aResult)
{
NS_NOTREACHED("how'd I get here?");
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP nsPluginHost::LockFactory(PRBool aLock)
{
NS_NOTREACHED("how'd I get here?");
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP nsPluginHost::Init()
{
return NS_OK;
@ -3580,7 +3563,7 @@ nsPluginHost::TrySetUpPluginInstance(const char *aMimeType,
NS_ASSERTION(pluginTag, "Must have plugin tag here!");
GetPluginFactory(mimetype, getter_AddRefs(plugin));
GetPlugin(mimetype, getter_AddRefs(plugin));
if (plugin) {
#if defined(XP_WIN) && !defined(WINCE)
@ -3601,7 +3584,7 @@ nsPluginHost::TrySetUpPluginInstance(const char *aMimeType,
}
}
#endif
result = plugin->CreateInstance(NULL, kIPluginInstanceIID, (void **)getter_AddRefs(instance));
result = plugin->CreatePluginInstance(getter_AddRefs(instance));
#if defined(XP_WIN) && !defined(WINCE)
if (!firstJavaPlugin && restoreOrigDir) {
@ -3657,12 +3640,11 @@ nsPluginHost::SetUpDefaultPluginInstance(const char *aMimeType,
if (!aURL)
return NS_ERROR_FAILURE;
GetPluginFactory("*", getter_AddRefs(plugin));
GetPlugin("*", getter_AddRefs(plugin));
nsresult result = NS_ERROR_OUT_OF_MEMORY;
if (plugin)
result = plugin->CreateInstance(NULL, kIPluginInstanceIID,
getter_AddRefs(instance));
result = plugin->CreatePluginInstance(getter_AddRefs(instance));
if (NS_FAILED(result))
return result;
@ -4019,7 +4001,7 @@ static nsresult ConvertToNative(nsIUnicodeEncoder *aEncoder,
}
static nsresult CreateNPAPIPlugin(const nsPluginTag *aPluginTag,
nsIPlugin **aOutNPAPIPlugnin)
nsIPlugin **aOutNPAPIPlugin)
{
nsresult rv;
nsCOMPtr <nsIPlatformCharset> pcs =
@ -4046,10 +4028,10 @@ static nsresult CreateNPAPIPlugin(const nsPluginTag *aPluginTag,
return nsNPAPIPlugin::CreatePlugin(fullPath.get(),
aPluginTag->mLibrary,
aOutNPAPIPlugnin);
aOutNPAPIPlugin);
}
NS_IMETHODIMP nsPluginHost::GetPluginFactory(const char *aMimeType, nsIPlugin** aPlugin)
NS_IMETHODIMP nsPluginHost::GetPlugin(const char *aMimeType, nsIPlugin** aPlugin)
{
nsresult rv = NS_ERROR_FAILURE;
*aPlugin = NULL;
@ -4064,7 +4046,7 @@ NS_IMETHODIMP nsPluginHost::GetPluginFactory(const char *aMimeType, nsIPlugin**
if (pluginTag) {
rv = NS_OK;
PLUGIN_LOG(PLUGIN_LOG_BASIC,
("nsPluginHost::GetPluginFactory Begin mime=%s, plugin=%s\n",
("nsPluginHost::GetPlugin Begin mime=%s, plugin=%s\n",
aMimeType, pluginTag->mFileName.get()));
#ifdef NS_DEBUG
@ -4106,7 +4088,7 @@ NS_IMETHODIMP nsPluginHost::GetPluginFactory(const char *aMimeType, nsIPlugin**
}
PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("nsPluginHost::GetPluginFactory End mime=%s, rv=%d, plugin=%p name=%s\n",
("nsPluginHost::GetPlugin End mime=%s, rv=%d, plugin=%p name=%s\n",
aMimeType, rv, *aPlugin,
(pluginTag ? pluginTag->mFileName.get() : "(not found)")));

View File

@ -58,7 +58,6 @@
#include "nsWeakReference.h"
#include "nsThreadUtils.h"
#include "nsTArray.h"
#include "nsIFactory.h"
class nsNPAPIPlugin;
class nsIComponentManager;
@ -198,7 +197,6 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPLUGINHOST
NS_DECL_NSIFACTORY
NS_DECL_NSIOBSERVER
NS_IMETHOD