Remove nsPIPluginHost. b=501388 r/sr=jst

This commit is contained in:
Josh Aas 2009-06-30 16:49:04 -04:00
parent a94deb09f1
commit 245392b64c
8 changed files with 112 additions and 176 deletions

View File

@ -144,7 +144,6 @@
#include "nsIObjectFrame.h"
#include "nsIObjectLoadingContent.h"
#include "nsIPluginHost.h"
#include "nsPIPluginHost.h"
// Oh, did I mention that I hate Microsoft for doing this to me?
#ifdef XP_WIN
@ -9728,9 +9727,8 @@ nsHTMLPluginObjElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
// will need some special treatment later
nsCOMPtr<nsIPluginHost> pluginHost = do_GetService(MOZ_PLUGIN_HOST_CONTRACTID);
nsCOMPtr<nsPIPluginHost> piPluginHost(do_QueryInterface(pluginHost));
if (piPluginHost)
piPluginHost->SetIsScriptableInstance(pi, PR_TRUE);
if (pluginHost)
pluginHost->SetIsScriptableInstance(pi, PR_TRUE);
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
rv = sXPConnect->WrapNative(cx, obj, pi, *iid, getter_AddRefs(holder));

View File

@ -72,7 +72,6 @@
#include "nsICachingChannel.h"
#include "nsPluginArray.h"
#include "nsIPluginHost.h"
#include "nsPIPluginHost.h"
#include "nsGeolocation.h"
#include "nsContentCID.h"
#include "nsLayoutStatics.h"
@ -5802,7 +5801,7 @@ nsGlobalWindow::InitJavaProperties()
// Check whether the plugin supports NPRuntime, if so, init through
// it, else use liveconnect.
nsCOMPtr<nsPIPluginHost> host(do_GetService("@mozilla.org/plugin/host;1"));
nsCOMPtr<nsIPluginHost> host(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
if (!host) {
return;
}

View File

@ -127,7 +127,6 @@
#include "nsObjectFrame.h"
#include "nsIObjectFrame.h"
#include "nsPluginNativeWindow.h"
#include "nsPIPluginHost.h"
#include "nsIPluginDocument.h"
#include "nsThreadUtils.h"
@ -423,10 +422,8 @@ public:
const char* GetPluginName()
{
if (mInstance && mPluginHost) {
nsCOMPtr<nsPIPluginHost> piPluginHost = do_QueryInterface(mPluginHost);
const char* name = NULL;
if (NS_SUCCEEDED(piPluginHost->GetPluginName(mInstance, &name)) &&
name)
if (NS_SUCCEEDED(mPluginHost->GetPluginName(mInstance, &name)) && name)
return name;
}
return "";
@ -2189,9 +2186,8 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
// create nsPluginNativeWindow object, it is derived from nsPluginWindow
// struct and allows to manipulate native window procedure
nsCOMPtr<nsIPluginHost> ph = do_GetService(MOZ_PLUGIN_HOST_CONTRACTID);
nsCOMPtr<nsPIPluginHost> pph(do_QueryInterface(ph));
if (pph)
pph->NewPluginNativeWindow(&mPluginWindow);
if (ph)
ph->NewPluginNativeWindow(&mPluginWindow);
else
mPluginWindow = nsnull;
@ -2260,9 +2256,8 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner()
// clean up plugin native window object
nsCOMPtr<nsIPluginHost> ph = do_GetService(MOZ_PLUGIN_HOST_CONTRACTID);
nsCOMPtr<nsPIPluginHost> pph(do_QueryInterface(ph));
if (pph) {
pph->DeletePluginNativeWindow(mPluginWindow);
if (ph) {
ph->DeletePluginNativeWindow(mPluginWindow);
mPluginWindow = nsnull;
}

View File

@ -74,7 +74,6 @@ XPIDLSRCS = \
nsIPluginInputStream.idl \
nsIPluginStreamListener.idl \
nsIPluginInstance.idl \
nsPIPluginHost.idl \
nsIPluginHost.idl \
nsIPluginDocument.idl \
$(NULL)

View File

@ -43,6 +43,7 @@
#include "nsIPluginTag.idl"
%{C++
#include "nsPluginNativeWindow.h"
#include "nsplugindefs.h"
#ifdef MOZILLA_INTERNAL_API
#include "nsString.h"
@ -62,6 +63,7 @@ interface nsIPluginStreamListener;
[ptr] native PRLibraryPtr(PRLibrary);
[ref] native nsIStreamListenerRef(nsIStreamListener *);
[ptr] native nsPluginNativeWindowPtr(nsPluginNativeWindow);
[scriptable, uuid(A2D6DC70-7456-4422-A9F6-D96F46868C0B)]
interface nsIPluginHost : nsIFactory
@ -140,12 +142,12 @@ interface nsIPluginHost : nsIFactory
%{C++
NS_IMETHOD
GetURL(nsISupports* pluginInst,
const char* url,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE) = 0;
const char* url,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE) = 0;
%}
/**
@ -182,17 +184,17 @@ interface nsIPluginHost : nsIFactory
%{C++
NS_IMETHOD
PostURL(nsISupports* pluginInst,
const char* url,
PRUint32 postDataLen,
const char* postData,
PRBool isFile = PR_FALSE,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE,
PRUint32 postHeadersLength = 0,
const char* postHeaders = NULL) = 0;
const char* url,
PRUint32 postDataLen,
const char* postData,
PRBool isFile = PR_FALSE,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE,
PRUint32 postHeadersLength = 0,
const char* postHeaders = NULL) = 0;
%}
/**
@ -209,8 +211,74 @@ interface nsIPluginHost : nsIFactory
* Which proxy/SOCKS to use is determined by the plugin.
*/
void findProxyForURL(in string aURL, out string aResult);
[noscript] void UserAgent(in nativeChar resultingAgentString);
/**
* To notify the plugin manager that the plugin created a script object
*/
[noscript] void setIsScriptableInstance(in nsIPluginInstance aInstance, in boolean aScriptable);
/**
* This method parses post buffer to find out case insensitive "Content-length" string
* and CR or LF some where after that, then it assumes there is http headers in
* the input buffer and continue to search for end of headers (CRLFCRLF or LFLF).
* It will *always malloc()* output buffer (caller is responsible to free it)
* if input buffer starts with LF, which comes from 4.x spec
* http://developer.netscape.com/docs/manuals/communicator/plugin/pgfn2.htm#1007754
* "If no custom headers are required, simply add a blank
* line ('\n') to the beginning of the file or buffer.",
* it skips that '\n' and considers rest of the input buffer as data.
* If "Content-length" string and end of headers is found
* it substitutes single LF with CRLF in the headers, so the end of headers
* always will be CRLFCRLF (single CR in headers, if any, remain untouched)
* else
* it puts "Content-length: "+size_of_data+CRLFCRLF at the beginning of the output buffer
* and memcpy data to the output buffer
*
* On failure outPostData and outPostDataLen will be set in 0.
* @param aInPostData - the post data
* @param aInPostDataLen - the length aInPostData
* @param aOutPostData - the buffer
* @param aOutPostDataLen - the length of aOutPostData
*/
[noscript] void parsePostBufferToFixHeaders(in string aInPostData,
in unsigned long aInPostDataLen,
out string aOutPostData,
out unsigned long aOutPostDataLen);
/**
* To create tmp file with Content len header in, it will use by http POST
*/
[noscript] void createTmpFileToPost(in string aPostDataURL, out string aTmpFileName);
/**
* Creates a new plugin native window object
*/
[noscript] void newPluginNativeWindow(out nsPluginNativeWindowPtr aPluginNativeWindow);
/**
* Deletes plugin native window object created by NewPluginNativeWindow
*/
[noscript] void deletePluginNativeWindow(in nsPluginNativeWindowPtr aPluginNativeWindow);
/**
* Instantiate a "dummy" java plugin if a java plugin that supports
* NPRuntime is installed. This plugin is used for exposing
* window.java and window.Packages. If the java plugin supports
* NPRuntime and instantiation was successful, aOwners instance will
* be non-null, if not, it will be null.
*/
[noscript] void instantiateDummyJavaPlugin(in nsIPluginInstanceOwner aOwner);
/**
* Get the plugin name for the plugin instance.
* @param aInstance the plugin instance object
* @param aPluginName returns a pointer to a shared readonly string value,
* it's only valid for the lifetime of the plugin instance - you must
* copy the string value if you need it longer than that.
*/
[noscript] void getPluginName(in nsIPluginInstance aInstance, [shared] out string aPluginName);
};
%{C++

View File

@ -1,115 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIPluginInstance.idl"
%{C++
#include "nsPluginNativeWindow.h"
%}
interface nsIPluginInstanceOwner;
[ptr] native nsPluginNativeWindowPtr(nsPluginNativeWindow);
[uuid(673811fb-83d6-4b8f-b1a9-bb3a9033f256)]
interface nsPIPluginHost : nsISupports
{
/**
* To notify the plugin manager that the plugin created a script object
*/
void setIsScriptableInstance(in nsIPluginInstance aInstance, in boolean aScriptable);
/**
* This method parses post buffer to find out case insensitive "Content-length" string
* and CR or LF some where after that, then it assumes there is http headers in
* the input buffer and continue to search for end of headers (CRLFCRLF or LFLF).
* It will *always malloc()* output buffer (caller is responsible to free it)
* if input buffer starts with LF, which comes from 4.x spec
* http://developer.netscape.com/docs/manuals/communicator/plugin/pgfn2.htm#1007754
* "If no custom headers are required, simply add a blank
* line ('\n') to the beginning of the file or buffer.",
* it skips that '\n' and considers rest of the input buffer as data.
* If "Content-length" string and end of headers is found
* it substitutes single LF with CRLF in the headers, so the end of headers
* always will be CRLFCRLF (single CR in headers, if any, remain untouched)
* else
* it puts "Content-length: "+size_of_data+CRLFCRLF at the beginning of the output buffer
* and memcpy data to the output buffer
*
* On failure outPostData and outPostDataLen will be set in 0.
* @param aInPostData - the post data
* @param aInPostDataLen - the length aInPostData
* @param aOutPostData - the buffer
* @param aOutPostDataLen - the length of aOutPostData
**/
void parsePostBufferToFixHeaders(in string aInPostData,
in unsigned long aInPostDataLen,
out string aOutPostData,
out unsigned long aOutPostDataLen);
/**
* To create tmp file with Content len header in, it will use by http POST
*/
void createTmpFileToPost(in string aPostDataURL, out string aTmpFileName);
/**
* Creates a new plugin native window object
*/
void newPluginNativeWindow(out nsPluginNativeWindowPtr aPluginNativeWindow);
/**
* Deletes plugin native window object created by NewPluginNativeWindow
*/
void deletePluginNativeWindow(in nsPluginNativeWindowPtr aPluginNativeWindow);
/**
* Instantiate a "dummy" java plugin if a java plugin that supports
* NPRuntime is installed. This plugin is used for exposing
* window.java and window.Packages. If the java plugin supports
* NPRuntime and instantiation was successful, aOwners instance will
* be non-null, if not, it will be null.
*/
[noscript] void instantiateDummyJavaPlugin(in nsIPluginInstanceOwner aOwner);
/**
* Get the plugin name for the plugin instance.
* @param aInstance the plugin instance object
* @param aPluginName returns a pointer to a shared readonly string value,
* it's only valid for the lifetime of the plugin instance - you must
* copy the string value if you need it longer than that.
*/
[noscript] void getPluginName(in nsIPluginInstance aInstance, [shared] out string aPluginName);
};

View File

@ -2480,10 +2480,9 @@ nsPluginHostImpl::~nsPluginHostImpl()
sInst = nsnull;
}
NS_IMPL_ISUPPORTS4(nsPluginHostImpl,
NS_IMPL_ISUPPORTS3(nsPluginHostImpl,
nsIPluginHost,
nsIObserver,
nsPIPluginHost,
nsISupportsWeakReference)
nsPluginHostImpl*
@ -5618,8 +5617,6 @@ nsPluginHostImpl::HandleBadPlugin(PRLibrary* aLibrary, nsIPluginInstance *aInsta
return rv;
}
// nsPIPluginHost interface
NS_IMETHODIMP
nsPluginHostImpl::SetIsScriptableInstance(nsIPluginInstance * aPluginInstance, PRBool aScriptable)
{
@ -5944,8 +5941,6 @@ nsPluginHostImpl::GetPluginName(nsIPluginInstance *aPluginInstance,
return NS_OK;
}
// end of nsPIPluginHost implementation
nsresult nsPluginHostImpl::AddUnusedLibrary(PRLibrary * aLibrary)
{
if (!mUnusedLibraries.Contains(aLibrary)) // don't add duplicates

View File

@ -40,7 +40,6 @@
#include "nsIPluginHost.h"
#include "nsIObserver.h"
#include "nsPIPluginHost.h"
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "prlink.h"
@ -211,7 +210,6 @@ public:
class nsPluginHostImpl : public nsIPluginHost,
public nsIObserver,
public nsPIPluginHost,
public nsSupportsWeakReference
{
public:
@ -227,30 +225,29 @@ public:
NS_DECL_NSIPLUGINHOST
NS_DECL_NSIFACTORY
NS_DECL_NSIOBSERVER
NS_DECL_NSPIPLUGINHOST
NS_IMETHOD
GetURL(nsISupports* pluginInst,
const char* url,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE);
const char* url,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE);
NS_IMETHOD
PostURL(nsISupports* pluginInst,
const char* url,
PRUint32 postDataLen,
const char* postData,
PRBool isFile = PR_FALSE,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE,
PRUint32 postHeadersLength = 0,
const char* postHeaders = NULL);
const char* url,
PRUint32 postDataLen,
const char* postData,
PRBool isFile = PR_FALSE,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE,
PRUint32 postHeadersLength = 0,
const char* postHeaders = NULL);
nsresult
NewPluginURLStream(const nsString& aURL,