diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 00:24:28 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 00:24:28 +0000 |
commit | 0306b3c7e97b23a91f44121b3a798ff6fa8c243f (patch) | |
tree | 8c20f9d2ea0f1c069fabd62c38428ad202734f70 /webkit | |
parent | 1cc48f14278f4bb882d633ab4776b09478e7f668 (diff) | |
download | chromium_src-0306b3c7e97b23a91f44121b3a798ff6fa8c243f.zip chromium_src-0306b3c7e97b23a91f44121b3a798ff6fa8c243f.tar.gz chromium_src-0306b3c7e97b23a91f44121b3a798ff6fa8c243f.tar.bz2 |
Implement NPN_GetValueForURL and NPN_SetValueForURL and add a stub for NPN_GetAuthenticationInfo. With these NPAPI functions there's no need to simulate being in Firefox and implement NPN_GetValue for NPNVserviceManager.
TEST=run manual test that Ken added in test\data\plugin over http
Review URL: http://codereview.chromium.org/251101
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28200 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/mozilla_extensions.cc | 323 | ||||
-rw-r--r-- | webkit/glue/plugins/mozilla_extensions.h | 99 | ||||
-rw-r--r-- | webkit/glue/plugins/nphostapi.h | 23 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_host.cc | 124 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_instance.cc | 45 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_instance.h | 9 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_lib_linux.cc | 8 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.cc | 6 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 5 | ||||
-rw-r--r-- | webkit/webkit.gyp | 3 |
10 files changed, 139 insertions, 506 deletions
diff --git a/webkit/glue/plugins/mozilla_extensions.cc b/webkit/glue/plugins/mozilla_extensions.cc deleted file mode 100644 index 2ca0a50..0000000 --- a/webkit/glue/plugins/mozilla_extensions.cc +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/glue/plugins/mozilla_extensions.h" - -#include <algorithm> - -#include "base/logging.h" -#include "base/string_util.h" -#include "googleurl/src/gurl.h" -#include "net/base/net_errors.h" -#include "third_party/npapi/bindings/npapi.h" -#include "webkit/glue/webkit_glue.h" -#include "webkit/glue/webplugin.h" -#include "webkit/glue/plugins/plugin_instance.h" - -#define QI_SUPPORTS_IID(iid, iface) \ - QI_SUPPORTS_IID_(iid, iface::GetIID(), iface) - -#define QI_SUPPORTS_IID_(src_iid, iface_iid, iface) \ - if (iid.Equals(iface_iid)) { \ - AddRef(); \ - *result = static_cast<iface*>(this); \ - return NS_OK; \ - } - -namespace NPAPI -{ - -void MozillaExtensionApi::DetachFromInstance() { - plugin_instance_ = NULL; -} - -bool MozillaExtensionApi::FindProxyForUrl(const char* url, - std::string* proxy) { - if ((!url) || (!proxy)) { - NOTREACHED(); - return false; - } - - return webkit_glue::FindProxyForUrl(GURL(std::string(url)), proxy); -} - -// nsISupports implementation -NS_IMETHODIMP MozillaExtensionApi::QueryInterface(REFNSIID iid, - void** result) { - static const nsIID knsISupportsIID = NS_ISUPPORTS_IID; - QI_SUPPORTS_IID_(iid, knsISupportsIID, nsIServiceManager) - QI_SUPPORTS_IID(iid, nsIServiceManager) - QI_SUPPORTS_IID(iid, nsIPluginManager) - QI_SUPPORTS_IID(iid, nsIPluginManager2) - QI_SUPPORTS_IID(iid, nsICookieStorage) - - NOTREACHED(); - return NS_ERROR_NO_INTERFACE; -} - -NS_IMETHODIMP_(nsrefcnt) MozillaExtensionApi::AddRef(void) { - return InterlockedIncrement(reinterpret_cast<LONG*>(&ref_count_)); -} - -NS_IMETHODIMP_(nsrefcnt) MozillaExtensionApi::Release(void) { - DCHECK(static_cast<int>(ref_count_) > 0); - if (InterlockedDecrement(reinterpret_cast<LONG*>(&ref_count_)) == 0) { - delete this; - return 0; - } - - return ref_count_; -} - -NS_IMETHODIMP MozillaExtensionApi::GetService(REFNSIID class_guid, - REFNSIID iid, - void** result) { - - static const nsIID kPluginManagerCID = NS_PLUGINMANAGER_CID; - static const nsIID kCookieStorageCID = NS_COOKIESTORAGE_CID; - - nsresult rv = NS_ERROR_FAILURE; - - if ((class_guid.Equals(kPluginManagerCID)) || - (class_guid.Equals(kCookieStorageCID))) { - rv = QueryInterface(iid, result); - } - - DCHECK(rv == NS_OK); - return rv; -} - -NS_IMETHODIMP MozillaExtensionApi::GetServiceByContractID( - const char* contract_id, - REFNSIID iid, - void** result) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::IsServiceInstantiated(REFNSIID class_guid, - REFNSIID iid, - PRBool* result) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::IsServiceInstantiatedByContractID( - const char* contract_id, - REFNSIID iid, - PRBool* result) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - - -NS_IMETHODIMP MozillaExtensionApi::GetValue(nsPluginManagerVariable variable, - void * value) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::ReloadPlugins(PRBool reloadPages) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::UserAgent( - const char** resultingAgentString) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::GetURL( - nsISupports* pluginInst, - const char* url, - const char* target, - nsIPluginStreamListener* streamListener, - const char* altHost, - const char* referrer, - PRBool forceJSEnabled) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::PostURL( - nsISupports* pluginInst, - const char* url, - unsigned int postDataLen, - const char* postData, - PRBool isFile, - const char* target, - nsIPluginStreamListener* streamListener, - const char* altHost, - const char* referrer, - PRBool forceJSEnabled , - unsigned int postHeadersLength, - const char* postHeaders) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::RegisterPlugin( - REFNSIID aCID, - const char *aPluginName, - const char *aDescription, - const char * * aMimeTypes, - const char * * aMimeDescriptions, - const char * * aFileExtensions, - PRInt32 aCount) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::UnregisterPlugin(REFNSIID aCID) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::GetURLWithHeaders( - nsISupports* pluginInst, - const char* url, - const char* target /* = NULL */, - nsIPluginStreamListener* streamListener /* = NULL */, - const char* altHost /* = NULL */, - const char* referrer /* = NULL */, - PRBool forceJSEnabled /* = PR_FALSE */, - PRUint32 getHeadersLength /* = 0 */, - const char* getHeaders /* = NULL */){ - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -// nsIPluginManager2 -NS_IMETHODIMP MozillaExtensionApi::BeginWaitCursor() { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::EndWaitCursor() { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::SupportsURLProtocol(const char* aProtocol, - PRBool* aResult) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::NotifyStatusChange(nsIPlugin* aPlugin, - nsresult aStatus) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::FindProxyForURL( - const char* aURL, - char** aResult) { - std::string proxy = "DIRECT"; - FindProxyForUrl(aURL, &proxy); - - // Allocate this using the NPAPI allocator. The plugin will call - // NPN_Free to free this. - char* result = static_cast<char*>(NPN_MemAlloc(proxy.length() + 1)); - strncpy(result, proxy.c_str(), proxy.length() + 1); - - *aResult = result; - return NS_OK; -} - -NS_IMETHODIMP MozillaExtensionApi::RegisterWindow( - nsIEventHandler* handler, - nsPluginPlatformWindowRef window) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::UnregisterWindow( - nsIEventHandler* handler, - nsPluginPlatformWindowRef win) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::AllocateMenuID(nsIEventHandler* aHandler, - PRBool aIsSubmenu, - PRInt16 *aResult) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::DeallocateMenuID(nsIEventHandler* aHandler, - PRInt16 aMenuID) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP MozillaExtensionApi::HasAllocatedMenuID(nsIEventHandler* aHandler, - PRInt16 aMenuID, - PRBool* aResult) { - NOTREACHED(); - return NS_ERROR_FAILURE; -} - -// nsICookieStorage -NS_IMETHODIMP MozillaExtensionApi::GetCookie( - const char* url, - void* cookie_buffer, - PRUint32& buffer_size) { - if ((!url) || (!cookie_buffer)) { - return NS_ERROR_INVALID_ARG; - } - - if (!plugin_instance_) - return NS_ERROR_FAILURE; - - webkit_glue::WebPlugin* webplugin = plugin_instance_->webplugin(); - if (!webplugin) - return NS_ERROR_FAILURE; - - // Bypass third-party cookie blocking by using the url as the policy_url. - GURL cookies_url((std::string(url))); - std::string cookies = webplugin->GetCookies(cookies_url, cookies_url); - - if (cookies.empty()) - return NS_ERROR_FAILURE; - - if(cookies.length() >= buffer_size) - return NS_ERROR_FAILURE; - - strncpy(static_cast<char*>(cookie_buffer), - cookies.c_str(), - cookies.length() + 1); - - buffer_size = cookies.length(); - return NS_OK; -} - -NS_IMETHODIMP MozillaExtensionApi::SetCookie( - const char* url, - const void* cookie_buffer, - PRUint32 buffer_size){ - if ((!url) || (!cookie_buffer) || (!buffer_size)) { - return NS_ERROR_INVALID_ARG; - } - - if (!plugin_instance_) - return NS_ERROR_FAILURE; - - webkit_glue::WebPlugin* webplugin = plugin_instance_->webplugin(); - if (!webplugin) - return NS_ERROR_FAILURE; - - std::string cookie(static_cast<const char*>(cookie_buffer), - buffer_size); - GURL cookies_url((std::string(url))); - webplugin->SetCookie(cookies_url, - cookies_url, - cookie); - return NS_OK; -} - - -} // namespace NPAPI diff --git a/webkit/glue/plugins/mozilla_extensions.h b/webkit/glue/plugins/mozilla_extensions.h deleted file mode 100644 index 59e69c1..0000000 --- a/webkit/glue/plugins/mozilla_extensions.h +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_GLUE_PLUGINS_MOZILLA_EXTENSIONS_H_ -#define WEBKIT_GLUE_PLUGINS_MOZILLA_EXTENSIONS_H_ - -#include <string> - -// Include npapi first to avoid definition clashes due to -// XP_WIN -#include "third_party/npapi/bindings/npapi.h" - -#include "third_party/mozilla/include/nsIServiceManager.h" -#include "third_party/mozilla/include/nsIPluginManager2.h" -#include "third_party/mozilla/include/nsICookieStorage.h" -#include "third_party/mozilla/include/nsError.h" - -#include "base/ref_counted.h" - -// NS_DECL_NSIPLUGINMANAGER doesn't include methods described as "C++" in the -// nsIPluginManager.idl. -#define NS_DECL_NSIPLUGINMANAGER_FIXED \ - NS_DECL_NSIPLUGINMANAGER \ - 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); \ - 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); \ - NS_IMETHOD \ - GetURLWithHeaders(nsISupports* pluginInst, \ - const char* url, \ - const char* target = NULL, \ - nsIPluginStreamListener* streamListener = NULL, \ - const char* altHost = NULL, \ - const char* referrer = NULL, \ - PRBool forceJSEnabled = PR_FALSE, \ - PRUint32 getHeadersLength = 0, \ - const char* getHeaders = NULL); - -// Avoid dependence on the nsIsupportsImpl.h and so on. -#ifndef NS_DECL_ISUPPORTS -#define NS_DECL_ISUPPORTS \ - NS_IMETHOD QueryInterface(REFNSIID aIID, \ - void** aInstancePtr); \ - NS_IMETHOD_(nsrefcnt) AddRef(void); \ - NS_IMETHOD_(nsrefcnt) Release(void); -#endif // NS_DECL_ISUPPORTS - -namespace NPAPI -{ - -class PluginInstance; - -// Implementation of extended Mozilla interfaces needed to support -// Sun's new Java plugin. -class MozillaExtensionApi : public nsIServiceManager, - public nsIPluginManager2, - public nsICookieStorage { - public: - MozillaExtensionApi(PluginInstance* plugin_instance) : - plugin_instance_(plugin_instance), ref_count_(0) { - } - - void DetachFromInstance(); - - NS_DECL_ISUPPORTS - NS_DECL_NSISERVICEMANAGER - NS_DECL_NSIPLUGINMANAGER_FIXED - NS_DECL_NSIPLUGINMANAGER2 - NS_DECL_NSICOOKIESTORAGE - - protected: - bool FindProxyForUrl(const char* url, std::string* proxy); - - protected: - scoped_refptr<NPAPI::PluginInstance> plugin_instance_; - unsigned long ref_count_; -}; - -} // namespace NPAPI - -#endif // WEBKIT_GLUE_PLUGINS_MOZILLA_EXTENSIONS_H_ diff --git a/webkit/glue/plugins/nphostapi.h b/webkit/glue/plugins/nphostapi.h index c6ee0af..d2ec615 100644 --- a/webkit/glue/plugins/nphostapi.h +++ b/webkit/glue/plugins/nphostapi.h @@ -186,6 +186,26 @@ typedef bool (*NPN_ConstructProcPtr)(NPP npp, const NPVariant *args, uint32_t argCount, NPVariant *result); +typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, + NPNURLVariable variable, + const char *url, + char **value, + uint32_t *len); +typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, + NPNURLVariable variable, + const char *url, + const char *value, + uint32_t len); +typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, + const char *protocol, + const char *host, + int32_t port, + const char *scheme, + const char *realm, + char **username, + uint32_t *ulen, + char **password, + uint32_t *plen); // // NPAPI Function table of NPP functions (functions provided by plugin to host) @@ -261,6 +281,9 @@ typedef struct _NPNetscapeFuncs { NPN_EnumerateProcPtr enumerate; NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall; NPN_ConstructProcPtr construct; + NPN_GetValueForURLPtr getvalueforurl; + NPN_SetValueForURLPtr setvalueforurl; + NPN_GetAuthenticationInfoPtr getauthenticationinfo; } NPNetscapeFuncs; // diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index 27445a5..343a1f4 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -101,6 +101,9 @@ void PluginHost::InitializeHostFuncs() { host_funcs_.enumerate = WebBindings::enumerate; host_funcs_.pluginthreadasynccall = NPN_PluginThreadAsyncCall; host_funcs_.construct = WebBindings::construct; + host_funcs_.getvalueforurl = NPN_GetValueForURL; + host_funcs_.setvalueforurl = NPN_SetValueForURL; + host_funcs_.getauthenticationinfo = NPN_GetAuthenticationInfo; } @@ -724,19 +727,6 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void *value) { rv = NPERR_NO_ERROR; break; } - case NPNVserviceManager: - { - NPAPI::PluginInstance* instance = - NPAPI::PluginInstance::GetInitializingInstance(); - if (instance) { - instance->GetServiceManager(reinterpret_cast<void**>(value)); - } else { - NOTREACHED(); - } - - rv = NPERR_NO_ERROR; - break; - } #if defined(OS_LINUX) case NPNVToolkit: // Tell them we are GTK2. (The alternative is GTK 1.2.) @@ -894,12 +884,116 @@ void NPN_PopPopupsEnabledState(NPP id) { } void NPN_PluginThreadAsyncCall(NPP id, - void (*func)(void *), - void *userData) { + void (*func)(void *), + void *userData) { scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); if (plugin) { plugin->PluginThreadAsyncCall(func, userData); } } +NPError NPN_GetValueForURL(NPP id, + NPNURLVariable variable, + const char *url, + char **value, + uint32_t *len) { + if (!id) + return NPERR_INVALID_PARAM; + + if (!url || !*url || !len) + return NPERR_INVALID_URL; + + *len = 0; + std::string result; + + switch (variable) { + case NPNURLVProxy: { + result = "DIRECT"; + if (!webkit_glue::FindProxyForUrl(GURL((std::string(url))), &result)) + return NPERR_GENERIC_ERROR; + + break; + } + case NPNURLVCookie: { + scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + if (!plugin) + return NPERR_GENERIC_ERROR; + + webkit_glue::WebPlugin* webplugin = plugin->webplugin(); + if (!webplugin) + return NPERR_GENERIC_ERROR; + + // Bypass third-party cookie blocking by using the url as the policy_url. + GURL cookies_url((std::string(url))); + result = webplugin->GetCookies(cookies_url, cookies_url); + break; + } + default: + return NPERR_GENERIC_ERROR; + } + + // Allocate this using the NPAPI allocator. The plugin will call + // NPN_Free to free this. + *value = static_cast<char*>(NPN_MemAlloc(result.length() + 1)); + strncpy(*value, result.c_str(), result.length() + 1); + *len = result.length(); + + return NPERR_NO_ERROR; +} + +NPError NPN_SetValueForURL(NPP id, + NPNURLVariable variable, + const char *url, + const char *value, + uint32_t len) { + if (!id) + return NPERR_INVALID_PARAM; + + if (!url || !*url) + return NPERR_INVALID_URL; + + switch (variable) { + case NPNURLVCookie: { + scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + if (!plugin) + return NPERR_GENERIC_ERROR; + + webkit_glue::WebPlugin* webplugin = plugin->webplugin(); + if (!webplugin) + return NPERR_GENERIC_ERROR; + + std::string cookie(value, len); + GURL cookies_url((std::string(url))); + webplugin->SetCookie(cookies_url, cookies_url, cookie); + return NPERR_NO_ERROR; + } + case NPNURLVProxy: + // We don't support setting proxy values, fall through... + break; + default: + // Fall through and return an error... + break; + } + + return NPERR_GENERIC_ERROR; +} + +NPError NPN_GetAuthenticationInfo(NPP id, + const char *protocol, + const char *host, + int32_t port, + const char *scheme, + const char *realm, + char **username, + uint32_t *ulen, + char **password, + uint32_t *plen) { + if (!id || !protocol || !host || !scheme || !realm || !username || + !ulen || !password || !plen) + return NPERR_INVALID_PARAM; + + // TODO: implement me (bug 23928) + return NPERR_GENERIC_ERROR; +} + } // extern "C" diff --git a/webkit/glue/plugins/plugin_instance.cc b/webkit/glue/plugins/plugin_instance.cc index ad8c9bf..db5954a 100644 --- a/webkit/glue/plugins/plugin_instance.cc +++ b/webkit/glue/plugins/plugin_instance.cc @@ -7,10 +7,8 @@ #include "webkit/glue/plugins/plugin_instance.h" #include "base/file_util.h" -#include "base/lazy_instance.h" #include "base/message_loop.h" #include "base/string_util.h" -#include "base/thread_local.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webplugin.h" #include "webkit/glue/webkit_glue.h" @@ -18,19 +16,10 @@ #include "webkit/glue/plugins/plugin_lib.h" #include "webkit/glue/plugins/plugin_stream_url.h" #include "webkit/glue/plugins/plugin_string_stream.h" -#if defined(OS_WIN) -#include "webkit/glue/plugins/mozilla_extensions.h" -#endif #include "net/base/escape.h" namespace NPAPI { -// Use TLS to store the PluginInstance object during its creation. We need to -// pass this instance to the service manager (MozillaExtensionApi) created as a -// result of NPN_GetValue in the context of NP_Initialize. -static base::LazyInstance<base::ThreadLocalPointer<PluginInstance> > lazy_tls( - base::LINKER_INITIALIZED); - PluginInstance::PluginInstance(PluginLib *plugin, const std::string &mime_type) : plugin_(plugin), npp_(0), @@ -196,14 +185,6 @@ void PluginInstance::NPP_Destroy() { DCHECK(savedData == 0); } -#if defined(OS_WIN) - // Clean up back references to this instance if any - if (mozilla_extenstions_) { - mozilla_extenstions_->DetachFromInstance(); - mozilla_extenstions_ = NULL; - } -#endif - for (unsigned int file_index = 0; file_index < files_created_.size(); file_index++) { file_util::Delete(files_created_[file_index], false); @@ -409,32 +390,6 @@ void PluginInstance::OnPluginThreadAsyncCall(void (*func)(void *), #endif } -PluginInstance* PluginInstance::SetInitializingInstance( - PluginInstance* instance) { - PluginInstance* old_instance = lazy_tls.Pointer()->Get(); - lazy_tls.Pointer()->Set(instance); - return old_instance; -} - -PluginInstance* PluginInstance::GetInitializingInstance() { - return lazy_tls.Pointer()->Get(); -} - -NPError PluginInstance::GetServiceManager(void** service_manager) { -#if defined(OS_WIN) - if (!mozilla_extenstions_) { - mozilla_extenstions_ = new MozillaExtensionApi(this); - } - - DCHECK(mozilla_extenstions_); - mozilla_extenstions_->QueryInterface(nsIServiceManager::GetIID(), - service_manager); -#else - NOTIMPLEMENTED(); -#endif - return NPERR_NO_ERROR; -} - void PluginInstance::PushPopupsEnabledState(bool enabled) { popups_enabled_stack_.push(enabled); } diff --git a/webkit/glue/plugins/plugin_instance.h b/webkit/glue/plugins/plugin_instance.h index 352dab5..2261ab4 100644 --- a/webkit/glue/plugins/plugin_instance.h +++ b/webkit/glue/plugins/plugin_instance.h @@ -34,7 +34,6 @@ class PluginHost; class PluginStream; class PluginStreamUrl; class PluginDataStream; -class MozillaExtensionApi; // A PluginInstance is an active, running instance of a Plugin. // A single plugin may have many PluginInstances. @@ -181,11 +180,6 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { void DidFinishManualLoading(); void DidManualLoadFail(); - NPError GetServiceManager(void** service_manager); - - static PluginInstance* SetInitializingInstance(PluginInstance* instance); - static PluginInstance* GetInitializingInstance(); - void PushPopupsEnabledState(bool enabled); void PopPopupsEnabledState(); @@ -235,9 +229,6 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { GURL get_url_; intptr_t get_notify_data_; bool use_mozilla_user_agent_; -#if defined(OS_WIN) - scoped_refptr<MozillaExtensionApi> mozilla_extenstions_; -#endif MessageLoop* message_loop_; scoped_refptr<PluginStreamUrl> plugin_data_stream_; diff --git a/webkit/glue/plugins/plugin_lib_linux.cc b/webkit/glue/plugins/plugin_lib_linux.cc index d925edc..2e196ac 100644 --- a/webkit/glue/plugins/plugin_lib_linux.cc +++ b/webkit/glue/plugins/plugin_lib_linux.cc @@ -14,10 +14,16 @@ // These headers must be included in this order to make the declaration gods // happy. #include "base/third_party/nspr/prcpucfg_linux.h" -#include "third_party/mozilla/include/nsplugindefs.h" namespace { +// Copied from nsplugindefs.h instead of including the file since it has a bunch +// of dependencies. +enum nsPluginVariable { + nsPluginVariable_NameString = 1, + nsPluginVariable_DescriptionString = 2 +}; + // Read the ELF header and return true if it is usable on // the current architecture (e.g. 32-bit ELF on 32-bit build). // Returns false on other errors as well. diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 4cb45ec..5ca970c 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -57,9 +57,6 @@ bool WebPluginDelegateImpl::Initialize( plugin_ = plugin; instance_->set_web_plugin(plugin_); - NPAPI::PluginInstance* old_instance = - NPAPI::PluginInstance::SetInitializingInstance(instance_); - if (quirks_ & PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES) { NPAPI::PluginLib* plugin_lib = instance()->plugin_lib(); if (plugin_lib->instance_count() > 1) { @@ -85,9 +82,6 @@ bool WebPluginDelegateImpl::Initialize( bool start_result = instance_->Start( url, argn.get(), argv.get(), argc, load_manually); - - NPAPI::PluginInstance::SetInitializingInstance(old_instance); - if (!start_result) return false; diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index c64b562b..8b60841 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -120,8 +120,6 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url, plugin_ = plugin; instance_->set_web_plugin(plugin); - NPAPI::PluginInstance* old_instance = - NPAPI::PluginInstance::SetInitializingInstance(instance_); int argc = 0; scoped_array<char*> argn(new char*[arg_names.size()]); @@ -138,9 +136,6 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url, bool start_result = instance_->Start( url, argn.get(), argv.get(), argc, load_manually); - - NPAPI::PluginInstance::SetInitializingInstance(old_instance); - if (!start_result) return false; diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index f04c262..9765830 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -482,8 +482,6 @@ 'glue/media/simple_data_source.h', 'glue/media/video_renderer_impl.cc', 'glue/media/video_renderer_impl.h', - 'glue/plugins/mozilla_extensions.cc', - 'glue/plugins/mozilla_extensions.h', 'glue/plugins/nphostapi.h', 'glue/plugins/fake_plugin_window_tracker_mac.h', 'glue/plugins/fake_plugin_window_tracker_mac.cc', @@ -699,7 +697,6 @@ # platforms. 'glue/glue_accessibility_object.cc', 'glue/glue_accessibility_object.h', - 'glue/plugins/mozilla_extensions.cc', 'glue/webaccessibility.h', 'glue/webaccessibilitymanager.h', 'glue/webaccessibilitymanager_impl.cc', |