mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 368185 - Clean up plugin files; changing class declarations to use macros
p=Kevin Zhang <kevin.heart@gmail.com> r+sr=jst
This commit is contained in:
parent
3ee8f8fd42
commit
56df067621
@ -38,6 +38,7 @@
|
||||
#ifndef ns4xPlugin_h__
|
||||
#define ns4xPlugin_h__
|
||||
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIPlugin.h"
|
||||
#include "nsIPluginInstancePeer.h"
|
||||
#include "nsIWindowlessPlugInstPeer.h"
|
||||
@ -116,34 +117,9 @@ public:
|
||||
virtual ~ns4xPlugin(void);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
//nsIFactory interface
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
//nsIPlugin interface
|
||||
|
||||
/**
|
||||
* Creates a new plugin instance, based on a MIME type. This
|
||||
* allows different impelementations to be created depending on
|
||||
* the specified MIME type.
|
||||
*/
|
||||
NS_IMETHOD CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID,
|
||||
const char* aPluginMIMEType,
|
||||
void **aResult);
|
||||
NS_DECL_NSIFACTORY
|
||||
NS_DECL_NSIPLUGIN
|
||||
|
||||
NS_IMETHOD Initialize(void);
|
||||
|
||||
NS_IMETHOD Shutdown(void);
|
||||
|
||||
NS_IMETHOD GetMIMEDescription(const char* *resultingDesc);
|
||||
|
||||
NS_IMETHOD GetValue(nsPluginVariable variable, void *value);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// ns4xPlugin-specific methods
|
||||
|
||||
|
@ -90,42 +90,8 @@ class ns4xPluginInstance : public nsIPluginInstance,
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIPluginInstance methods
|
||||
|
||||
/**
|
||||
* Actually initialize the plugin instance. This calls the 4.x <b>newp</b>
|
||||
* callback, and may return an error (which is why it is distinct from the
|
||||
* constructor.) If an error is returned, the caller should <i>not</i>
|
||||
* continue to use the <b>ns4xPluginInstance</b> object.
|
||||
*/
|
||||
NS_METHOD Initialize(nsIPluginInstancePeer* peer);
|
||||
|
||||
NS_IMETHOD GetPeer(nsIPluginInstancePeer* *resultingPeer);
|
||||
|
||||
NS_IMETHOD Start(void);
|
||||
|
||||
NS_IMETHOD Stop(void);
|
||||
|
||||
NS_IMETHOD Destroy(void);
|
||||
|
||||
NS_IMETHOD SetWindow(nsPluginWindow* window);
|
||||
|
||||
NS_IMETHOD NewStream(nsIPluginStreamListener** listener);
|
||||
|
||||
NS_IMETHOD Print(nsPluginPrint* platformPrint);
|
||||
|
||||
NS_IMETHOD GetValue(nsPluginInstanceVariable variable, void *value);
|
||||
|
||||
NS_IMETHOD HandleEvent(nsPluginEvent* event, PRBool* handled);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIScriptablePlugin methods
|
||||
|
||||
NS_IMETHOD GetScriptablePeer(void * *aScriptablePeer);
|
||||
|
||||
NS_IMETHOD GetScriptableInterface(nsIID * *aScriptableInterface);
|
||||
NS_DECL_NSIPLUGININSTANCE
|
||||
NS_DECL_NSISCRIPTABLEPLUGIN
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIPluginInstanceInternal methods
|
||||
|
@ -54,16 +54,7 @@ class ns4xPluginStreamListener : public nsIPluginStreamListener,
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// from nsIPluginStreamListener:
|
||||
NS_IMETHOD OnStartBinding(nsIPluginStreamInfo* pluginInfo);
|
||||
NS_IMETHOD OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
|
||||
nsIInputStream* input, PRUint32 length);
|
||||
NS_IMETHOD OnFileAvailable( nsIPluginStreamInfo* pluginInfo,
|
||||
const char* fileName);
|
||||
NS_IMETHOD OnStopBinding(nsIPluginStreamInfo* pluginInfo, nsresult status);
|
||||
NS_IMETHOD GetStreamType(nsPluginStreamType *result);
|
||||
|
||||
NS_DECL_NSIPLUGINSTREAMLISTENER
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
// ns4xPluginStreamListener specific methods:
|
||||
|
@ -297,7 +297,9 @@ PRBool ReadSectionHeader(nsPluginManifestLineReader& reader, const char *token)
|
||||
class nsPluginDocReframeEvent: public nsRunnable {
|
||||
public:
|
||||
nsPluginDocReframeEvent(nsISupportsArray* aDocs) { mDocs = aDocs; }
|
||||
NS_IMETHOD Run();
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
nsCOMPtr<nsISupportsArray> mDocs;
|
||||
};
|
||||
|
||||
@ -955,20 +957,23 @@ public:
|
||||
nsPluginUnloadEvent(PRLibrary* aLibrary)
|
||||
: mLibrary(aLibrary)
|
||||
{}
|
||||
|
||||
NS_IMETHOD Run() {
|
||||
if (mLibrary) {
|
||||
// put our unload call in a saftey wrapper
|
||||
NS_TRY_SAFE_CALL_VOID(PR_UnloadLibrary(mLibrary), nsnull, nsnull);
|
||||
} else {
|
||||
NS_WARNING("missing library from nsPluginUnloadEvent");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
PRLibrary* mLibrary;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP nsPluginUnloadEvent::Run()
|
||||
{
|
||||
if (mLibrary) {
|
||||
// put our unload call in a saftey wrapper
|
||||
NS_TRY_SAFE_CALL_VOID(PR_UnloadLibrary(mLibrary), nsnull, nsnull);
|
||||
} else {
|
||||
NS_WARNING("missing library from nsPluginUnloadEvent");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// unload plugin asynchronously if possible, otherwise just unload now
|
||||
nsresult PostPluginUnloadEvent(PRLibrary* aLibrary)
|
||||
{
|
||||
@ -1050,8 +1055,8 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIPluginStreamInfo interface
|
||||
|
||||
// nsI4xPluginStreamInfo interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetContentType(nsMIMEType* result);
|
||||
|
||||
|
@ -64,6 +64,9 @@
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
// XXX this file really doesn't think this is possible, but ...
|
||||
#include "nsIFactory.h"
|
||||
|
||||
class ns4xPlugin;
|
||||
class nsIComponentManager;
|
||||
class nsIFile;
|
||||
@ -274,139 +277,18 @@ public:
|
||||
|
||||
//nsIPluginHost interface - used to communicate to the nsPluginInstanceOwner
|
||||
|
||||
NS_IMETHOD
|
||||
Init(void);
|
||||
|
||||
NS_IMETHOD
|
||||
Destroy(void);
|
||||
|
||||
NS_IMETHOD
|
||||
LoadPlugins(void);
|
||||
|
||||
NS_IMETHOD
|
||||
GetPluginFactory(const char *aMimeType, nsIPlugin** aPlugin);
|
||||
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiatePluginForChannel(nsIChannel* aChannel,
|
||||
nsIPluginInstanceOwner* aOwner,
|
||||
nsIStreamListener** aListener);
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL, nsIPluginInstanceOwner *aOwner);
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiateFullPagePlugin(const char *aMimeType, nsIURI* aURI, nsIStreamListener *&aStreamListener, nsIPluginInstanceOwner *aOwner);
|
||||
|
||||
NS_IMETHOD
|
||||
SetUpPluginInstance(const char *aMimeType, nsIURI *aURL, nsIPluginInstanceOwner *aOwner);
|
||||
|
||||
NS_IMETHOD
|
||||
IsPluginEnabledForType(const char* aMimeType);
|
||||
|
||||
NS_IMETHOD
|
||||
IsPluginEnabledForExtension(const char* aExtension, const char* &aMimeType);
|
||||
|
||||
NS_IMETHOD
|
||||
GetPluginCount(PRUint32* aPluginCount);
|
||||
|
||||
NS_IMETHOD
|
||||
GetPlugins(PRUint32 aPluginCount, nsIDOMPlugin** aPluginArray);
|
||||
|
||||
NS_IMETHOD
|
||||
HandleBadPlugin(PRLibrary* aLibrary, nsIPluginInstance *instance);
|
||||
|
||||
//nsIPluginManager2 interface - secondary methods that nsIPlugin communicates to
|
||||
|
||||
NS_IMETHOD
|
||||
BeginWaitCursor(void);
|
||||
|
||||
NS_IMETHOD
|
||||
EndWaitCursor(void);
|
||||
|
||||
NS_IMETHOD
|
||||
SupportsURLProtocol(const char* protocol, PRBool *result);
|
||||
|
||||
NS_IMETHOD
|
||||
NotifyStatusChange(nsIPlugin* plugin, nsresult errorStatus);
|
||||
|
||||
NS_IMETHOD
|
||||
FindProxyForURL(const char* url, char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
RegisterWindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window);
|
||||
|
||||
NS_IMETHOD
|
||||
UnregisterWindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window);
|
||||
|
||||
NS_IMETHOD
|
||||
AllocateMenuID(nsIEventHandler* handler, PRBool isSubmenu, PRInt16 *result);
|
||||
|
||||
NS_IMETHOD
|
||||
DeallocateMenuID(nsIEventHandler* handler, PRInt16 menuID);
|
||||
|
||||
NS_IMETHOD
|
||||
HasAllocatedMenuID(nsIEventHandler* handler, PRInt16 menuID, PRBool *result);
|
||||
NS_DECL_NSIPLUGINHOST
|
||||
NS_DECL_NSIPLUGINMANAGER2
|
||||
|
||||
NS_IMETHOD
|
||||
ProcessNextEvent(PRBool *bEventHandled);
|
||||
|
||||
// nsIFactory interface, from nsIPlugin.
|
||||
// XXX not currently used?
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
// nsIFileUtilities interface
|
||||
|
||||
NS_IMETHOD GetProgramPath(const char* *result);
|
||||
|
||||
NS_IMETHOD GetTempDirPath(const char* *result);
|
||||
|
||||
NS_IMETHOD NewTempFileName(const char* prefix, PRUint32 bufLen, char* resultBuf);
|
||||
|
||||
// nsICookieStorage interface
|
||||
|
||||
/**
|
||||
* Retrieves a cookie from the browser's persistent cookie store.
|
||||
* @param inCookieURL URL string to look up cookie with.
|
||||
* @param inOutCookieBuffer buffer large enough to accomodate cookie data.
|
||||
* @param inOutCookieSize on input, size of the cookie buffer, on output cookie's size.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetCookie(const char* inCookieURL, void* inOutCookieBuffer, PRUint32& inOutCookieSize);
|
||||
|
||||
/**
|
||||
* Stores a cookie in the browser's persistent cookie store.
|
||||
* @param inCookieURL URL string store cookie with.
|
||||
* @param inCookieBuffer buffer containing cookie data.
|
||||
* @param inCookieSize specifies size of cookie data.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
SetCookie(const char* inCookieURL, const void* inCookieBuffer, PRUint32 inCookieSize);
|
||||
|
||||
// Methods from nsIObserver
|
||||
NS_IMETHOD
|
||||
Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData);
|
||||
|
||||
// Methods from nsPIPluginHost
|
||||
NS_IMETHOD
|
||||
SetIsScriptableInstance(nsIPluginInstance *aPluginInstance, PRBool aScriptable);
|
||||
|
||||
NS_IMETHOD
|
||||
ParsePostBufferToFixHeaders(const char *inPostData, PRUint32 inPostDataLen,
|
||||
char **outPostData, PRUint32 *outPostDataLen);
|
||||
|
||||
NS_IMETHOD
|
||||
CreateTmpFileToPost(const char *postDataURL, char **pTmpFileName);
|
||||
|
||||
NS_IMETHOD
|
||||
NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow);
|
||||
|
||||
NS_IMETHOD
|
||||
DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow);
|
||||
NS_DECL_NSIFACTORY
|
||||
NS_DECL_NSIFILEUTILITIES
|
||||
NS_DECL_NSICOOKIESTORAGE
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSPIPLUGINHOST
|
||||
|
||||
/* Called by GetURL and PostURL */
|
||||
|
||||
@ -428,9 +310,6 @@ public:
|
||||
AddHeadersToChannel(const char *aHeadersData, PRUint32 aHeadersDataLen,
|
||||
nsIChannel *aGenericChannel);
|
||||
|
||||
NS_IMETHOD
|
||||
StopPluginInstance(nsIPluginInstance* aInstance);
|
||||
|
||||
NS_IMETHOD
|
||||
AddUnusedLibrary(PRLibrary * aLibrary);
|
||||
|
||||
|
@ -61,104 +61,13 @@ public:
|
||||
virtual ~nsPluginInstancePeerImpl();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPLUGININSTANCEPEER
|
||||
NS_DECL_NSIWINDOWLESSPLUGININSTANCEPEER
|
||||
NS_DECL_NSIPLUGININSTANCEPEER2
|
||||
NS_DECL_NSIPLUGINTAGINFO
|
||||
NS_DECL_NSIPLUGINTAGINFO2
|
||||
|
||||
// nsIPluginInstancePeer interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginInstancePeerVariable variable, void *value);
|
||||
|
||||
NS_IMETHOD
|
||||
GetMIMEType(nsMIMEType *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetMode(nsPluginMode *result);
|
||||
|
||||
NS_IMETHOD
|
||||
NewStream(nsMIMEType type, const char* target, nsIOutputStream* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
ShowStatus(const char* message);
|
||||
|
||||
NS_IMETHOD
|
||||
SetWindowSize(PRUint32 width, PRUint32 height);
|
||||
|
||||
// nsIPluginInstancePeer2 interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetJSWindow(JSObject* *outJSWindow);
|
||||
|
||||
NS_IMETHOD
|
||||
GetJSThread(PRUint32 *outThreadID);
|
||||
|
||||
NS_IMETHOD
|
||||
GetJSContext(JSContext* *outContext);
|
||||
|
||||
// nsIWindowlessPluginInstancePeer
|
||||
|
||||
// (Corresponds to NPN_InvalidateRect.)
|
||||
NS_IMETHOD
|
||||
InvalidateRect(nsPluginRect *invalidRect);
|
||||
|
||||
// (Corresponds to NPN_InvalidateRegion.)
|
||||
NS_IMETHOD
|
||||
InvalidateRegion(nsPluginRegion invalidRegion);
|
||||
|
||||
// (Corresponds to NPN_ForceRedraw.)
|
||||
NS_IMETHOD
|
||||
ForceRedraw(void);
|
||||
|
||||
/* The tag info interfaces all pass through calls to the
|
||||
nsPluginInstanceOwner (see nsObjectFrame.cpp) */
|
||||
|
||||
//nsIPluginTagInfo interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values);
|
||||
|
||||
NS_IMETHOD
|
||||
GetAttribute(const char* name, const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetDOMElement(nsIDOMElement* *result);
|
||||
|
||||
//nsIPluginTagInfo2 interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetTagType(nsPluginTagType *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetTagText(const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetParameters(PRUint16& n, const char*const*& names, const char*const*& values);
|
||||
|
||||
NS_IMETHOD
|
||||
GetParameter(const char* name, const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetDocumentBase(const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetDocumentEncoding(const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetAlignment(const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetWidth(PRUint32 *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetHeight(PRUint32 *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetBorderVertSpace(PRUint32 *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetBorderHorizSpace(PRUint32 *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetUniqueID(PRUint32 *result);
|
||||
|
||||
//XXX Why isn't this ifdef'd like the class declaration?
|
||||
//nsIJVMPluginTagInfo interface
|
||||
|
||||
NS_IMETHOD
|
||||
@ -176,10 +85,7 @@ public:
|
||||
NS_IMETHOD
|
||||
GetMayScript(PRBool *result);
|
||||
|
||||
// nsPIPluginInstancePeer interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetOwner(nsIPluginInstanceOwner **aOwner);
|
||||
NS_DECL_NSPIPLUGININSTANCEPEER
|
||||
|
||||
//locals
|
||||
|
||||
|
@ -77,8 +77,8 @@ public:
|
||||
MPARAM GetWParam() { return mWParam; };
|
||||
MPARAM GetLParam() { return mLParam; };
|
||||
PRBool InUse() { return (mWnd!=NULL || mMsg!=0); };
|
||||
|
||||
NS_IMETHOD Run();
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
protected:
|
||||
PluginWindowWeakRef mPluginWindowRef;
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
LPARAM GetLParam() { return mLParam; };
|
||||
PRBool InUse() { return (mWnd!=NULL || mMsg!=0); };
|
||||
|
||||
NS_IMETHOD Run();
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
protected:
|
||||
PluginWindowWeakRef mPluginWindowRef;
|
||||
@ -183,14 +183,19 @@ public:
|
||||
nsDelayedPopupsEnabledEvent(nsIPluginInstanceInternal *inst)
|
||||
: mInst(inst)
|
||||
{}
|
||||
NS_IMETHOD Run() {
|
||||
mInst->PushPopupsEnabledState(PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIPluginInstanceInternal> mInst;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run()
|
||||
{
|
||||
mInst->PushPopupsEnabledState(PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* New plugin window procedure
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user