summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/browser/plugin_service.cc60
-rw-r--r--content/browser/plugin_service.h21
-rw-r--r--content/browser/renderer_host/render_message_filter.cc2
-rw-r--r--content/plugin/plugin_thread.cc4
-rw-r--r--content/public/common/content_client.h10
-rw-r--r--content/shell/shell_content_client.cc4
-rw-r--r--content/shell/shell_content_client.h2
-rw-r--r--content/test/test_content_client.cc4
-rw-r--r--content/test/test_content_client.h2
9 files changed, 24 insertions, 85 deletions
diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc
index 82c689c..7d2c811 100644
--- a/content/browser/plugin_service.cc
+++ b/content/browser/plugin_service.cc
@@ -116,21 +116,19 @@ PluginService::PluginService()
: ui_locale_(
content::GetContentClient()->browser()->GetApplicationLocale()),
filter_(NULL) {
- GetPluginList()->set_will_load_plugins_callback(
+ webkit::npapi::PluginList::Singleton()->set_will_load_plugins_callback(
base::Bind(&WillLoadPluginsCallback));
RegisterPepperPlugins();
- content::GetContentClient()->AddNPAPIPlugins(GetPluginList());
-
// Load any specified on the command line as well.
const CommandLine* command_line = CommandLine::ForCurrentProcess();
FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin);
if (!path.empty())
- AddExtraPluginPath(path);
+ webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path);
path = command_line->GetSwitchValuePath(switches::kExtraPluginDir);
if (!path.empty())
- AddExtraPluginPath(path);
+ webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(path);
#if defined(OS_MACOSX)
// We need to know when the browser comes forward so we can bring modal plugin
@@ -184,7 +182,8 @@ void PluginService::StartWatchingPlugins() {
// Get the list of all paths for registering the FilePathWatchers
// that will track and if needed reload the list of plugins on runtime.
std::vector<FilePath> plugin_dirs;
- GetPluginList()->GetPluginDirectories(&plugin_dirs);
+ webkit::npapi::PluginList::Singleton()->GetPluginDirectories(
+ &plugin_dirs);
for (size_t i = 0; i < plugin_dirs.size(); ++i) {
// FilePathWatcher can not handle non-absolute paths under windows.
@@ -429,8 +428,8 @@ bool PluginService::GetPluginInfoArray(
std::vector<webkit::WebPluginInfo>* plugins,
std::vector<std::string>* actual_mime_types) {
bool use_stale = false;
- GetPluginList()->GetPluginInfoArray(url, mime_type, allow_wildcard,
- &use_stale, plugins, actual_mime_types);
+ webkit::npapi::PluginList::Singleton()->GetPluginInfoArray(
+ url, mime_type, allow_wildcard, &use_stale, plugins, actual_mime_types);
return use_stale;
}
@@ -477,7 +476,8 @@ bool PluginService::GetPluginInfo(int render_process_id,
bool PluginService::GetPluginInfoByPath(const FilePath& plugin_path,
webkit::WebPluginInfo* info) {
std::vector<webkit::WebPluginInfo> plugins;
- GetPluginList()->GetPluginsIfNoRefreshNeeded(&plugins);
+ webkit::npapi::PluginList::Singleton()->GetPluginsIfNoRefreshNeeded(
+ &plugins);
for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin();
it != plugins.end();
@@ -491,6 +491,10 @@ bool PluginService::GetPluginInfoByPath(const FilePath& plugin_path,
return false;
}
+void PluginService::RefreshPluginList() {
+ webkit::npapi::PluginList::Singleton()->RefreshPlugins();
+}
+
void PluginService::GetPlugins(const GetPluginsCallback& callback) {
scoped_refptr<base::MessageLoopProxy> target_loop(
MessageLoop::current()->message_loop_proxy());
@@ -501,7 +505,8 @@ void PluginService::GetPlugins(const GetPluginsCallback& callback) {
target_loop, callback));
#else
std::vector<webkit::WebPluginInfo> cached_plugins;
- if (GetPluginList()->GetPluginsIfNoRefreshNeeded(&cached_plugins)) {
+ if (webkit::npapi::PluginList::Singleton()->GetPluginsIfNoRefreshNeeded(
+ &cached_plugins)) {
// Can't assume the caller is reentrant.
target_loop->PostTask(FROM_HERE,
base::Bind(&RunGetPluginsCallback, callback, cached_plugins));
@@ -525,7 +530,7 @@ void PluginService::GetPluginsInternal(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
std::vector<webkit::WebPluginInfo> plugins;
- GetPluginList()->GetPlugins(&plugins);
+ webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins);
target_loop->PostTask(FROM_HERE,
base::Bind(&RunGetPluginsCallback, callback, plugins));
@@ -540,7 +545,7 @@ void PluginService::OnWaitableEventSignaled(
hklm_key_.StartWatching();
}
- GetPluginList()->RefreshPlugins();
+ webkit::npapi::PluginList::Singleton()->RefreshPlugins();
PurgePluginListCache(NULL, false);
#else
// This event should only get signaled on a Windows machine.
@@ -576,7 +581,8 @@ void PluginService::RegisterPepperPlugins() {
// TODO(abarth): It seems like the PepperPluginRegistry should do this work.
PepperPluginRegistry::ComputeList(&ppapi_plugins_);
for (size_t i = 0; i < ppapi_plugins_.size(); ++i) {
- RegisterInternalPlugin(ppapi_plugins_[i].ToWebPluginInfo());
+ webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(
+ ppapi_plugins_[i].ToWebPluginInfo());
}
}
@@ -617,31 +623,3 @@ void PluginService::RegisterFilePathWatcher(
DCHECK(result);
}
#endif
-
-void PluginService::RefreshPlugins() {
- GetPluginList()->RefreshPlugins();
-}
-
-void PluginService::AddExtraPluginPath(const FilePath& path) {
- GetPluginList()->AddExtraPluginPath(path);
-}
-
-void PluginService::RemoveExtraPluginPath(const FilePath& path) {
- GetPluginList()->RemoveExtraPluginPath(path);
-}
-
-void PluginService::UnregisterInternalPlugin(const FilePath& path) {
- GetPluginList()->UnregisterInternalPlugin(path);
-}
-
-webkit::npapi::PluginList* PluginService::GetPluginList() {
- return webkit::npapi::PluginList::Singleton();
-}
-
-void PluginService::RegisterInternalPlugin(const webkit::WebPluginInfo& info) {
- GetPluginList()->RegisterInternalPlugin(info);
-}
-
-string16 PluginService::GetPluginGroupName(const std::string& plugin_name) {
- return GetPluginList()->GetPluginGroupName(plugin_name);
-}
diff --git a/content/browser/plugin_service.h b/content/browser/plugin_service.h
index e7a894b..2b2c69f 100644
--- a/content/browser/plugin_service.h
+++ b/content/browser/plugin_service.h
@@ -54,7 +54,6 @@ namespace webkit {
namespace npapi {
class PluginGroup;
class PluginList;
-struct PluginEntryPoints;
}
}
@@ -152,6 +151,10 @@ class CONTENT_EXPORT PluginService
bool GetPluginInfoByPath(const FilePath& plugin_path,
webkit::WebPluginInfo* info);
+ // Marks the plugin list as dirty and will cause the plugins to be reloaded
+ // on the next access through GetPlugins() or GetPluginGroups().
+ void RefreshPluginList();
+
// Asynchronously loads plugins if necessary and then calls back to the
// provided function on the calling MessageLoop on completion.
void GetPlugins(const GetPluginsCallback& callback);
@@ -173,22 +176,6 @@ class CONTENT_EXPORT PluginService
}
content::PluginServiceFilter* filter() { return filter_; }
-
- // The following functions are wrappers around webkit::npapi::PluginList.
- // These must be used instead of those in order to ensure that we have a
- // single global list in the component build and so that we don't
- // accidentally load plugins in the wrong process or thread. Refer to
- // PluginList for further documentation of these functions.
- void RefreshPlugins();
- void AddExtraPluginPath(const FilePath& path);
- void RemoveExtraPluginPath(const FilePath& path);
- void UnregisterInternalPlugin(const FilePath& path);
- void RegisterInternalPlugin(const webkit::WebPluginInfo& info);
- string16 GetPluginGroupName(const std::string& plugin_name);
-
- // TODO(dpranke): This should be private.
- webkit::npapi::PluginList* GetPluginList();
-
private:
friend struct DefaultSingletonTraits<PluginService>;
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 624af29..001c6b2 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -522,7 +522,7 @@ void RenderMessageFilter::OnGetPlugins(
const base::TimeTicks now = base::TimeTicks::Now();
if (now - last_plugin_refresh_time_ >= threshold) {
// Only refresh if the threshold hasn't been exceeded yet.
- PluginService::GetInstance()->RefreshPlugins();
+ PluginService::GetInstance()->RefreshPluginList();
last_plugin_refresh_time_ = now;
}
}
diff --git a/content/plugin/plugin_thread.cc b/content/plugin/plugin_thread.cc
index 7951a8f..195bffe 100644
--- a/content/plugin/plugin_thread.cc
+++ b/content/plugin/plugin_thread.cc
@@ -27,7 +27,6 @@
#include "ipc/ipc_channel_handle.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/plugins/npapi/plugin_lib.h"
-#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/npapi/webplugin_delegate_impl.h"
#if defined(TOOLKIT_USES_GTK)
@@ -115,9 +114,6 @@ PluginThread::PluginThread()
content::GetContentClient()->plugin()->PluginProcessStarted(
plugin.get() ? plugin->plugin_info().name : string16());
- content::GetContentClient()->AddNPAPIPlugins(
- webkit::npapi::PluginList::Singleton());
-
// Certain plugins, such as flash, steal the unhandled exception filter
// thus we never get crash reports when they fault. This call fixes it.
message_loop()->set_exception_restoration(true);
diff --git a/content/public/common/content_client.h b/content/public/common/content_client.h
index 840e370..7386ef7 100644
--- a/content/public/common/content_client.h
+++ b/content/public/common/content_client.h
@@ -29,12 +29,6 @@ namespace sandbox {
class TargetPolicy;
}
-namespace webkit {
-namespace npapi {
-class PluginList;
-}
-}
-
namespace content {
class ContentBrowserClient;
@@ -85,10 +79,6 @@ class CONTENT_EXPORT ContentClient {
virtual void AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) = 0;
- // Gives the embedder a chance to register its own internal NPAPI plugins.
- virtual void AddNPAPIPlugins(
- webkit::npapi::PluginList* plugin_list) = 0;
-
// Returns whether the given message should be allowed to be sent from a
// swapped out renderer.
virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) = 0;
diff --git a/content/shell/shell_content_client.cc b/content/shell/shell_content_client.cc
index c6bf11f..bc98458 100644
--- a/content/shell/shell_content_client.cc
+++ b/content/shell/shell_content_client.cc
@@ -22,10 +22,6 @@ void ShellContentClient::AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) {
}
-void ShellContentClient::AddNPAPIPlugins(
- webkit::npapi::PluginList* plugin_list) {
-}
-
bool ShellContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) {
return false;
}
diff --git a/content/shell/shell_content_client.h b/content/shell/shell_content_client.h
index 388e200..8494e99 100644
--- a/content/shell/shell_content_client.h
+++ b/content/shell/shell_content_client.h
@@ -19,8 +19,6 @@ class ShellContentClient : public ContentClient {
virtual void SetGpuInfo(const GPUInfo& gpu_info) OVERRIDE;
virtual void AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) OVERRIDE;
- virtual void AddNPAPIPlugins(
- webkit::npapi::PluginList* plugin_list) OVERRIDE;
virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) OVERRIDE;
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
virtual std::string GetUserAgent(bool* overriding) const OVERRIDE;
diff --git a/content/test/test_content_client.cc b/content/test/test_content_client.cc
index e1d6d43..7f329f1 100644
--- a/content/test/test_content_client.cc
+++ b/content/test/test_content_client.cc
@@ -23,10 +23,6 @@ void TestContentClient::AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) {
}
-void TestContentClient::AddNPAPIPlugins(
- webkit::npapi::PluginList* plugin_list) {
-}
-
bool TestContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) {
return true;
}
diff --git a/content/test/test_content_client.h b/content/test/test_content_client.h
index d4b27bf..0506b08 100644
--- a/content/test/test_content_client.h
+++ b/content/test/test_content_client.h
@@ -19,8 +19,6 @@ class TestContentClient : public content::ContentClient {
virtual void SetGpuInfo(const content::GPUInfo& gpu_info) OVERRIDE;
virtual void AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) OVERRIDE;
- virtual void AddNPAPIPlugins(
- webkit::npapi::PluginList* plugin_list) OVERRIDE;
virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) OVERRIDE;
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
virtual std::string GetUserAgent(bool* overriding) const OVERRIDE;