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 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
/* -*- 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.
*/
////////////////////////////////////////////////////////////////////////////////
/**
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
*
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
* get linked with the plugin. You will however need to link with the "backward
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
* browsers.
*
* <P>See nsplugin.h for an overview of how this interface fits with the
* overall plugin architecture.
*/
////////////////////////////////////////////////////////////////////////////////
#ifndef nsIPluginManager_h___
#define nsIPluginManager_h___
#include "nsplugindefs.h"
#include "nsISupports.h"
class nsIPluginStreamListener;
/**
* The nsIPluginManager interface defines the minimum set of functionality that
* the browser will support if it allows plugins. Plugins can call QueryInterface
* to determine if a plugin manager implements more specific APIs or other
* browser interfaces for the plugin to use (e.g. nsINetworkManager).
*/
class nsIPluginManager : public nsISupports {
public:
/**
* Returns the value of a variable associated with the plugin manager.
*
* (Corresponds to NPN_GetValue.)
*
* @param variable - the plugin manager variable to get
* @param value - the address of where to store the resulting value
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
GetValue(nsPluginManagerVariable variable, void *value) = 0;
/**
* Causes the plugins directory to be searched again for new plugin
* libraries.
*
* (Corresponds to NPN_ReloadPlugins.)
*
* @param reloadPages - indicates whether currently visible pages should
* also be reloaded
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
ReloadPlugins(PRBool reloadPages) = 0;
/**
* Returns the user agent string for the browser.
*
* (Corresponds to NPN_UserAgent.)
*
* @param resultingAgentString - the resulting user agent string
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
UserAgent(const char* *resultingAgentString) = 0;
#ifdef NEW_PLUGIN_STREAM_API
NS_IMETHOD
GetURL(nsISupports* pluginInst,
const char* url,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
nsPluginStreamType streamType = nsPluginStreamType_Normal,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE) = 0;
NS_IMETHOD
PostURL(nsISupports* pluginInst,
const char* url,
PRUint32 postDataLen,
const char* postData,
PRBool isFile = PR_FALSE,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
nsPluginStreamType streamType = nsPluginStreamType_Normal,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE,
PRUint32 postHeadersLength = 0,
const char* postHeaders = NULL) = 0;
#else // !NEW_PLUGIN_STREAM_API
/**
* Fetches a URL.
*
* (Corresponds to NPN_GetURL and NPN_GetURLNotify.)
*
* @param pluginInst - the plugin making the request. If NULL, the URL
* is fetched in the background.
* @param url - the URL to fetch
* @param target - the target window into which to load the URL
* @param notifyData - when present, URLNotify is called passing the
* notifyData back to the client. When NULL, this call behaves like
* NPN_GetURL.
* @param altHost - an IP-address string that will be used instead of the
* host specified in the URL. This is used to prevent DNS-spoofing
* attacks. Can be defaulted to NULL meaning use the host in the URL.
* @param referrer - the referring URL (may be NULL)
* @param forceJSEnabled - forces JavaScript to be enabled for 'javascript:'
* URLs, even if the user currently has JavaScript disabled (usually
* specify PR_FALSE)
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
GetURL(nsISupports* pluginInst, const char* url, const char* target,
void* notifyData = NULL, const char* altHost = NULL,
const char* referrer = NULL, PRBool forceJSEnabled = PR_FALSE) = 0;
/**
* Posts to a URL with post data and/or post headers.
*
* (Corresponds to NPN_PostURL and NPN_PostURLNotify.)
*
* @param pluginInst - the plugin making the request. If NULL, the URL
* is fetched in the background.
* @param url - the URL to fetch
* @param target - the target window into which to load the URL
* @param postDataLength - the length of postData (if non-NULL)
* @param postData - the data to POST. NULL specifies that there is not post
* data
* @param isFile - whether the postData specifies the name of a file to
* post instead of data. The file will be deleted afterwards.
* @param notifyData - when present, URLNotify is called passing the
* notifyData back to the client. When NULL, this call behaves like
* NPN_GetURL.
* @param altHost - an IP-address string that will be used instead of the
* host specified in the URL. This is used to prevent DNS-spoofing
* attacks. Can be defaulted to NULL meaning use the host in the URL.
* @param referrer - the referring URL (may be NULL)
* @param forceJSEnabled - forces JavaScript to be enabled for 'javascript:'
* URLs, even if the user currently has JavaScript disabled (usually
* specify PR_FALSE)
* @param postHeadersLength - the length of postHeaders (if non-NULL)
* @param postHeaders - the headers to POST. NULL specifies that there
* are no post headers
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
PostURL(nsISupports* pluginInst, 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) = 0;
#endif // !NEW_PLUGIN_STREAM_API
};
#define NS_IPLUGINMANAGER_IID \
{ /* da58ad80-4eb6-11d2-8164-006008119d7a */ \
0xda58ad80, \
0x4eb6, \
0x11d2, \
{0x81, 0x64, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
////////////////////////////////////////////////////////////////////////////////
#endif /* nsIPluginManager_h___ */
|