1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsPluginHostImpl_h__
#define nsPluginHostImpl_h__
#include "xp_core.h"
#include "nsIPluginManager.h"
#include "nsIPluginManager2.h"
#include "nsIPluginHost.h"
#include "nsCRT.h"
#include "prlink.h"
#include "nsIMalloc.h"
class ns4xPlugin;
class nsPluginTag
{
public:
nsPluginTag();
~nsPluginTag();
nsPluginTag *mNext;
char *mName;
char *mDescription;
char *mMimeType;
char *mMimeDescription;
char *mExtensions;
PRInt32 mVariants;
char **mMimeTypeArray;
char **mMimeDescriptionArray;
char **mExtensionsArray;
PRLibrary *mLibrary;
nsIPlugin *mEntryPoint;
PRUint32 mFlags;
};
#define NS_PLUGIN_FLAG_ENABLED 0x0001 //is this plugin enabled?
#define NS_PLUGIN_FLAG_OLDSCHOOL 0x0002 //is this a pre-xpcom plugin?
class nsPluginHostImpl : public nsIPluginManager2,
public nsIPluginHost
{
public:
nsPluginHostImpl();
~nsPluginHostImpl();
void* operator new(size_t sz) {
void* rv = new char[sz];
nsCRT::zero(rv, sz);
return rv;
}
NS_DECL_ISUPPORTS
//nsIPluginManager interface
NS_IMETHOD
GetValue(nsPluginManagerVariable variable, void *value);
NS_IMETHOD
ReloadPlugins(PRBool reloadPages);
NS_IMETHOD
UserAgent(const char* *resultingAgentString);
NS_IMETHOD
GetURL(nsISupports* inst, const char* url, const char* target,
void* notifyData = NULL, const char* altHost = NULL,
const char* referrer = NULL, PRBool forceJSEnabled = PR_FALSE);
NS_IMETHOD
PostURL(nsISupports* inst, const char* url, const char* target,
PRUint32 postDataLen, const char* postData,
PRBool isFile = PR_FALSE, void* notifyData = NULL,
const char* altHost = NULL, const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE,
PRUint32 postHeadersLength = 0, const char* postHeaders = NULL);
//nsIPluginHost interface
NS_IMETHOD
Init(void);
NS_IMETHOD
Destroy(void);
NS_IMETHOD
LoadPlugins(void);
NS_IMETHOD
InstantiatePlugin(const char *aMimeType, nsIURL *aURL, nsIPluginInstanceOwner *aOwner);
NS_IMETHOD
InstantiatePlugin(const char *aMimeType, nsString& aURLSpec, nsIPluginInstanceOwner *aOwner);
NS_IMETHOD
InstantiatePlugin(const char *aMimeType, nsString& aURLSpec,
nsIStreamListener *&aStreamListener, nsIPluginInstanceOwner *aOwner);
NS_IMETHOD
NewPluginStream(const nsString& aURL, nsIPluginInstance *aInstance, void *aNotifyData);
NS_IMETHOD
NewPluginStream(const nsString& aURL, nsIPluginInstanceOwner *aOwner, void *aNotifyData);
NS_IMETHOD
NewPluginStream(nsIStreamListener *&aStreamListener, nsIPluginInstance *aInstance, void *aNotifyData);
//nsIPluginManager2 interface
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_IMETHOD
ProcessNextEvent(PRBool *bEventHandled);
//nsIFactory interface
NS_IMETHOD CreateInstance(nsISupports *aOuter,
REFNSIID aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
private:
char *mPluginPath;
nsPluginTag *mPlugins;
nsIMalloc *mMalloc;
PRBool mPluginsLoaded;
};
#endif
|