Eliminated nsINetworkManager and moved it's methods to nsIPluginManager/nsIPluginManager2.

git-svn-id: svn://10.0.0.236/trunk@10368 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
warren%netscape.com
1998-09-18 07:21:21 +00:00
parent 5580f46827
commit 4dc47505d5
8 changed files with 184 additions and 312 deletions

View File

@@ -1,134 +0,0 @@
/* -*- 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 nsINetworkManager_h___
#define nsINetworkManager_h___
#include "nsplugindefs.h"
#include "nsISupports.h"
/**
* The nsINetworkManager interface provides access to the network for URL get
* and post operations.
*/
class nsINetworkManager : public nsISupports {
public:
/**
* Fetches a URL.
*
* (Corresponds to NPN_GetURL and NPN_GetURLNotify.)
*
* @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* peer, 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 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* peer, 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;
/**
* Returns the proxy info for a given URL. The caller is required to
* free the resulting memory with nsIMalloc::Free. The result will be in the
* following format
*
* i) "DIRECT" -- no proxy
* ii) "PROXY xxx.xxx.xxx.xxx" -- use proxy
* iii) "SOCKS xxx.xxx.xxx.xxx" -- use SOCKS
* iv) Mixed. e.g. "PROXY 111.111.111.111;PROXY 112.112.112.112",
* "PROXY 111.111.111.111;SOCKS 112.112.112.112"....
*
* Which proxy/SOCKS to use is determined by the plugin.
*/
NS_IMETHOD
FindProxyForURL(const char* url, char* *result) = 0;
};
#define NS_INETWORKMANAGER_IID \
{ /* fc2eede0-20fe-11d2-8160-006008119d7a */ \
0xfc2eede0, \
0x20fe, \
0x11d2, \
{0x81, 0x60, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
////////////////////////////////////////////////////////////////////////////////
#endif /* nsINetworkManager_h___ */

View File

@@ -82,14 +82,73 @@ public:
NS_IMETHOD
UserAgent(const char* *resultingAgentString) = 0;
/**
* Fetches a URL.
*
* (Corresponds to NPN_GetURL and NPN_GetURLNotify.)
*
* @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* peer, 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 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* peer, 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;
};
#define NS_IPLUGINMANAGER_IID \
{ /* f10b9600-a1bc-11d1-85b1-00805f0e4dfe */ \
0xf10b9600, \
0xa1bc, \
0x11d1, \
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
{ /* da58ad80-4eb6-11d2-8164-006008119d7a */ \
0xda58ad80, \
0x4eb6, \
0x11d2, \
{0x81, 0x64, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -82,6 +82,22 @@ public:
NS_IMETHOD
NotifyStatusChange(nsIPlugin* plugin, nsresult errorStatus) = 0;
/**
* Returns the proxy info for a given URL. The caller is required to
* free the resulting memory with nsIMalloc::Free. The result will be in the
* following format
*
* i) "DIRECT" -- no proxy
* ii) "PROXY xxx.xxx.xxx.xxx" -- use proxy
* iii) "SOCKS xxx.xxx.xxx.xxx" -- use SOCKS
* iv) Mixed. e.g. "PROXY 111.111.111.111;PROXY 112.112.112.112",
* "PROXY 111.111.111.111;SOCKS 112.112.112.112"....
*
* Which proxy/SOCKS to use is determined by the plugin.
*/
NS_IMETHOD
FindProxyForURL(const char* url, char* *result) = 0;
////////////////////////////////////////////////////////////////////////////
// New top-level window handling calls for Mac:
@@ -159,11 +175,11 @@ public:
};
#define NS_IPLUGINMANAGER2_IID \
{ /* 29c4ae70-019a-11d2-815b-006008119d7a */ \
0x29c4ae70, \
0x019a, \
{ /* d2962dc0-4eb6-11d2-8164-006008119d7a */ \
0xd2962dc0, \
0x4eb6, \
0x11d2, \
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
{0x81, 0x64, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -1,134 +0,0 @@
/* -*- 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 nsINetworkManager_h___
#define nsINetworkManager_h___
#include "nsplugindefs.h"
#include "nsISupports.h"
/**
* The nsINetworkManager interface provides access to the network for URL get
* and post operations.
*/
class nsINetworkManager : public nsISupports {
public:
/**
* Fetches a URL.
*
* (Corresponds to NPN_GetURL and NPN_GetURLNotify.)
*
* @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* peer, 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 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* peer, 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;
/**
* Returns the proxy info for a given URL. The caller is required to
* free the resulting memory with nsIMalloc::Free. The result will be in the
* following format
*
* i) "DIRECT" -- no proxy
* ii) "PROXY xxx.xxx.xxx.xxx" -- use proxy
* iii) "SOCKS xxx.xxx.xxx.xxx" -- use SOCKS
* iv) Mixed. e.g. "PROXY 111.111.111.111;PROXY 112.112.112.112",
* "PROXY 111.111.111.111;SOCKS 112.112.112.112"....
*
* Which proxy/SOCKS to use is determined by the plugin.
*/
NS_IMETHOD
FindProxyForURL(const char* url, char* *result) = 0;
};
#define NS_INETWORKMANAGER_IID \
{ /* fc2eede0-20fe-11d2-8160-006008119d7a */ \
0xfc2eede0, \
0x20fe, \
0x11d2, \
{0x81, 0x60, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
////////////////////////////////////////////////////////////////////////////////
#endif /* nsINetworkManager_h___ */

View File

@@ -82,14 +82,73 @@ public:
NS_IMETHOD
UserAgent(const char* *resultingAgentString) = 0;
/**
* Fetches a URL.
*
* (Corresponds to NPN_GetURL and NPN_GetURLNotify.)
*
* @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* peer, 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 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* peer, 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;
};
#define NS_IPLUGINMANAGER_IID \
{ /* f10b9600-a1bc-11d1-85b1-00805f0e4dfe */ \
0xf10b9600, \
0xa1bc, \
0x11d1, \
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
{ /* da58ad80-4eb6-11d2-8164-006008119d7a */ \
0xda58ad80, \
0x4eb6, \
0x11d2, \
{0x81, 0x64, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -82,6 +82,22 @@ public:
NS_IMETHOD
NotifyStatusChange(nsIPlugin* plugin, nsresult errorStatus) = 0;
/**
* Returns the proxy info for a given URL. The caller is required to
* free the resulting memory with nsIMalloc::Free. The result will be in the
* following format
*
* i) "DIRECT" -- no proxy
* ii) "PROXY xxx.xxx.xxx.xxx" -- use proxy
* iii) "SOCKS xxx.xxx.xxx.xxx" -- use SOCKS
* iv) Mixed. e.g. "PROXY 111.111.111.111;PROXY 112.112.112.112",
* "PROXY 111.111.111.111;SOCKS 112.112.112.112"....
*
* Which proxy/SOCKS to use is determined by the plugin.
*/
NS_IMETHOD
FindProxyForURL(const char* url, char* *result) = 0;
////////////////////////////////////////////////////////////////////////////
// New top-level window handling calls for Mac:
@@ -159,11 +175,11 @@ public:
};
#define NS_IPLUGINMANAGER2_IID \
{ /* 29c4ae70-019a-11d2-815b-006008119d7a */ \
0x29c4ae70, \
0x019a, \
{ /* d2962dc0-4eb6-11d2-8164-006008119d7a */ \
0xd2962dc0, \
0x4eb6, \
0x11d2, \
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
{0x81, 0x64, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -301,6 +301,19 @@ public:
NS_IMETHOD
UserAgent(const char* *result);
NS_IMETHOD
GetURL(nsISupports* peer, 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* peer, 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);
////////////////////////////////////////////////////////////////////////////
// from nsIPluginManager2:
@@ -319,6 +332,9 @@ public:
NS_IMETHOD
NotifyStatusChange(nsIPlugin* plugin, nsresult errorStatus);
NS_IMETHOD
FindProxyForURL(const char* url, char* *result);
////////////////////////////////////////////////////////////////////////////
// New top-level window handling calls for Mac:
@@ -349,25 +365,6 @@ public:
NS_IMETHOD
ProcessNextEvent(PRBool *bEventHandled);
////////////////////////////////////////////////////////////////////////////
// from nsINetworkManager:
NS_IMETHOD
GetURL(nsISupports* peer, 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* peer, 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);
NS_IMETHOD
FindProxyForURL(const char* url, char* *result);
////////////////////////////////////////////////////////////////////////////
// nsPluginManager specific methods:

View File

@@ -57,7 +57,6 @@
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
static NS_DEFINE_IID(kIPluginManager2IID, NS_IPLUGINMANAGER2_IID);
static NS_DEFINE_IID(kINetworkManagerIID, NS_INETWORKMANAGER_IID);
static NS_DEFINE_IID(kIJNIEnvIID, NS_IJNIENV_IID);
static NS_DEFINE_IID(kILiveConnectPluginInstancePeerIID, NS_ILIVECONNECTPLUGININSTANCEPEER_IID);
static NS_DEFINE_IID(kIWindowlessPluginInstancePeerIID, NS_IWINDOWLESSPLUGININSTANCEPEER_IID);
@@ -203,11 +202,6 @@ nsPluginManager::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr
AddRef();
return NS_OK;
}
if (aIID.Equals(kINetworkManagerIID)) {
*aInstancePtr = (nsINetworkManager*) this;
AddRef();
return NS_OK;
}
#if 0 // Browser interface should be JNI from now on. Hence all new code
// should be written using JNI. sudu.
if (aIID.Equals(kIJRIEnvIID)) {
@@ -558,7 +552,6 @@ nsPluginManager::ProcessNextEvent(PRBool *bEventHandled)
}
////////////////////////////////////////////////////////////////////////////////
// from nsINetworkManager:
#include "plevent.h"