diff options
author | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-05 01:23:44 +0000 |
---|---|---|
committer | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-05 01:23:44 +0000 |
commit | 47217cf0e17aa7aa5da0401bd5ea17203da4aed7 (patch) | |
tree | 3d9720e09cb0eacc8a5a0d59c26f3123ffc57ba2 | |
parent | 5a5fdc08c1ae8fdfce391f1a17c5fbb6097ab280 (diff) | |
download | chromium_src-47217cf0e17aa7aa5da0401bd5ea17203da4aed7.zip chromium_src-47217cf0e17aa7aa5da0401bd5ea17203da4aed7.tar.gz chromium_src-47217cf0e17aa7aa5da0401bd5ea17203da4aed7.tar.bz2 |
Revert r108744, r108753 - "Modify code in chrome to call wrapper functions on PluginService"
TBR=jam@chromium.org
Review URL: http://codereview.chromium.org/8475020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108760 0039d316-1c4b-4281-b951-d872f2087c98
26 files changed, 132 insertions, 150 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 984e89f..d1ef581 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -61,6 +61,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/default_plugin.h" #include "chrome/common/extensions/extension_l10n_util.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/json_pref_store.h" @@ -89,6 +90,7 @@ #include "net/url_request/url_request_context_getter.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/l10n/l10n_util.h" +#include "webkit/plugins/npapi/plugin_list.h" #if defined(OS_WIN) #include "views/focus/view_storage.h" @@ -790,12 +792,15 @@ void BrowserProcessImpl::CreateIOThread() { plugin_service->set_filter(ChromePluginServiceFilter::GetInstance()); plugin_service->StartWatchingPlugins(); + // Add the Chrome specific plugins. + chrome::RegisterInternalDefaultPlugin(); + // Register the internal Flash if available. FilePath path; if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableInternalFlash) && PathService::Get(chrome::FILE_FLASH_PLUGIN, &path)) { - plugin_service->AddExtraPluginPath(path); + webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path); } #if defined(OS_POSIX) @@ -803,7 +808,8 @@ void BrowserProcessImpl::CreateIOThread() { // e.g. ~/.config/chromium/Plugins. FilePath user_data_dir; if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { - plugin_service->AddExtraPluginPath(user_data_dir.Append("Plugins")); + webkit::npapi::PluginList::Singleton()->AddExtraPluginDir( + user_data_dir.Append("Plugins")); } #endif diff --git a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc index 9c5aed1..eb14534 100644 --- a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc +++ b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc @@ -25,6 +25,7 @@ #include "net/url_request/url_request_test_job.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "webkit/plugins/npapi/plugin_list.h" using content::BrowserThread; @@ -115,7 +116,7 @@ class GViewRequestInterceptorTest : public testing::Test { handler_ = new content::DummyResourceHandler(); - PluginService::GetInstance()->RefreshPlugins(); + PluginService::GetInstance()->RefreshPluginList(); PluginService::GetInstance()->GetPlugins(base::Bind(&QuitMessageLoop)); MessageLoop::current()->RunAllPending(); } @@ -139,17 +140,17 @@ class GViewRequestInterceptorTest : public testing::Test { void RegisterPDFPlugin() { webkit::WebPluginInfo info; info.path = pdf_path_; - PluginService::GetInstance()->RegisterInternalPlugin(info); + webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); - PluginService::GetInstance()->RefreshPlugins(); + PluginService::GetInstance()->RefreshPluginList(); PluginService::GetInstance()->GetPlugins(base::Bind(&QuitMessageLoop)); MessageLoop::current()->RunAllPending(); } void UnregisterPDFPlugin() { - PluginService::GetInstance()->UnregisterInternalPlugin(pdf_path_); + webkit::npapi::PluginList::Singleton()->UnregisterInternalPlugin(pdf_path_); - PluginService::GetInstance()->RefreshPlugins(); + PluginService::GetInstance()->RefreshPluginList(); PluginService::GetInstance()->GetPlugins(base::Bind(&QuitMessageLoop)); MessageLoop::current()->RunAllPending(); } diff --git a/chrome/browser/component_updater/npapi_flash_component_installer.cc b/chrome/browser/component_updater/npapi_flash_component_installer.cc index 7b4d404..86c68a6 100644 --- a/chrome/browser/component_updater/npapi_flash_component_installer.cc +++ b/chrome/browser/component_updater/npapi_flash_component_installer.cc @@ -18,6 +18,7 @@ #include "chrome/common/chrome_paths.h" #include "content/browser/plugin_service.h" #include "content/public/browser/browser_thread.h" +#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/webplugininfo.h" using content::BrowserThread; @@ -106,7 +107,7 @@ bool NPAPIFlashComponentInstaller::Install(base::DictionaryValue* manifest, return false; // Installation is done. Now tell the rest of chrome. current_version_ = version; - PluginService::GetInstance()->RefreshPlugins(); + webkit::npapi::PluginList::Singleton()->RefreshPlugins(); return true; } @@ -203,9 +204,10 @@ void StartFlashUpdateRegistration(ComponentUpdateService* cus, // the information for free. void RegisterNPAPIFlashComponent(ComponentUpdateService* cus) { #if !defined(OS_CHROMEOS) + webkit::npapi::PluginList* plugins = webkit::npapi::PluginList::Singleton(); FilePath path = GetNPAPIFlashBaseDirectory().Append(kFlashPluginFileName); - PluginService::GetInstance()->AddExtraPluginPath(path); - PluginService::GetInstance()->RefreshPlugins(); + plugins->AddExtraPluginPath(path); + plugins->RefreshPlugins(); // Post the task to the FILE thread because IO may be done once the plugins // are loaded. diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc index 9dd2a9a..0cb8e5f 100644 --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc @@ -20,10 +20,10 @@ #include "chrome/browser/component_updater/component_updater_service.h" #include "chrome/browser/plugin_prefs.h" #include "chrome/common/chrome_paths.h" -#include "content/browser/plugin_service.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/pepper_plugin_info.h" #include "ppapi/c/private/ppb_pdf.h" +#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/plugin_constants.h" #include "webkit/plugins/ppapi/plugin_module.h" @@ -167,9 +167,9 @@ void RegisterPepperFlashWithChrome(const FilePath& path, if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) return; PluginPrefs::EnablePluginGlobally(kEnablePepperFlash, plugin_info.path); - PluginService::GetInstance()->RegisterInternalPlugin( + webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( plugin_info.ToWebPluginInfo()); - PluginService::GetInstance()->RefreshPlugins(); + webkit::npapi::PluginList::Singleton()->RefreshPlugins(); } } // namespace @@ -321,8 +321,8 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) { } // namespace void RegisterPepperFlashComponent(ComponentUpdateService* cus) { -// #if defined(GOOGLE_CHROME_BUILD) +//#if defined(GOOGLE_CHROME_BUILD) BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, NewRunnableFunction(&StartPepperFlashUpdateRegistration, cus)); -// #endif +//#endif } diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 4a599a3..04e028a 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -96,6 +96,7 @@ #include "net/base/registry_controlled_domain.h" #include "webkit/database/database_tracker.h" #include "webkit/database/database_util.h" +#include "webkit/plugins/npapi/plugin_list.h" #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/cros/cros_library.h" @@ -968,8 +969,8 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { bool plugins_changed = false; for (size_t i = 0; i < extension->plugins().size(); ++i) { const Extension::PluginInfo& plugin = extension->plugins()[i]; - PluginService::GetInstance()->RefreshPlugins(); - PluginService::GetInstance()->AddExtraPluginPath(plugin.path); + webkit::npapi::PluginList::Singleton()->RefreshPlugins(); + webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path); plugins_changed = true; ChromePluginServiceFilter* filter = ChromePluginServiceFilter::GetInstance(); @@ -1067,8 +1068,9 @@ void ExtensionService::NotifyExtensionUnloaded( if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(&ForceShutdownPlugin, plugin.path))) NOTREACHED(); - PluginService::GetInstance()->RefreshPlugins(); - PluginService::GetInstance()->RemoveExtraPluginPath(plugin.path); + webkit::npapi::PluginList::Singleton()->RefreshPlugins(); + webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( + plugin.path); plugins_changed = true; ChromePluginServiceFilter::GetInstance()->UnrestrictPlugin(plugin.path); } @@ -2447,7 +2449,7 @@ void ExtensionService::UpdatePluginListWithNaClModules() { if (mime_iter->mime_type == kNaClPluginMimeType) { // This plugin handles "application/x-nacl". - PluginService::GetInstance()-> + webkit::npapi::PluginList::Singleton()-> UnregisterInternalPlugin(pepper_info->path); webkit::WebPluginInfo info = pepper_info->ToWebPluginInfo(); @@ -2466,8 +2468,8 @@ void ExtensionService::UpdatePluginListWithNaClModules() { info.mime_types.push_back(mime_type_info); } - PluginService::GetInstance()->RefreshPlugins(); - PluginService::GetInstance()->RegisterInternalPlugin(info); + webkit::npapi::PluginList::Singleton()->RefreshPlugins(); + webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); // This plugin has been modified, no need to check the rest of its // types, but continue checking other plugins. break; diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 7f2db89..2342d74 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -181,6 +181,7 @@ #include "content/common/child_process_info.h" #include "content/public/browser/notification_service.h" #include "content/public/common/url_fetcher.h" +#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/webplugininfo.h" // TODO(port): port browser_distribution.h. diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc index 4d81c68..c909c69 100644 --- a/chrome/browser/plugin_observer.cc +++ b/chrome/browser/plugin_observer.cc @@ -22,6 +22,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "webkit/plugins/npapi/plugin_group.h" +#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/webplugininfo.h" namespace { diff --git a/chrome/browser/plugin_prefs.cc b/chrome/browser/plugin_prefs.cc index 340be8b..c20886e 100644 --- a/chrome/browser/plugin_prefs.cc +++ b/chrome/browser/plugin_prefs.cc @@ -480,7 +480,7 @@ void PluginPrefs::SetPolicyEnforcedPluginPatterns( webkit::npapi::PluginList* PluginPrefs::GetPluginList() { if (plugin_list_) return plugin_list_; - return PluginService::GetInstance()->GetPluginList(); + return webkit::npapi::PluginList::Singleton(); } void PluginPrefs::GetPreferencesDataOnFileThread() { diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm index a821e1e..c969a4f 100644 --- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm +++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm @@ -13,11 +13,11 @@ #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" #import "chrome/browser/ui/cocoa/info_bubble_view.h" #import "chrome/browser/ui/cocoa/l10n_util.h" -#include "content/browser/plugin_service.h" #include "grit/generated_resources.h" #include "skia/ext/skia_utils_mac.h" #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/l10n/l10n_util.h" +#include "webkit/plugins/npapi/plugin_list.h" namespace { @@ -245,7 +245,7 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) { for (std::set<std::string>::iterator it = plugins.begin(); it != plugins.end(); ++it) { NSString* name = SysUTF16ToNSString( - PluginService::GetInstance()->GetPluginGroupName(*it)); + webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it)); if ([name length] == 0) name = base::SysUTF8ToNSString(*it); [pluginArray addObject:name]; diff --git a/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc b/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc index b414230..821bf32 100644 --- a/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc @@ -17,7 +17,6 @@ #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/common/content_settings.h" -#include "content/browser/plugin_service.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" @@ -27,6 +26,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/text/text_elider.h" #include "ui/gfx/gtk_util.h" +#include "webkit/plugins/npapi/plugin_list.h" namespace { @@ -109,7 +109,7 @@ void ContentSettingBubbleGtk::BuildBubble() { for (std::set<std::string>::const_iterator it = plugins.begin(); it != plugins.end(); ++it) { std::string name = UTF16ToUTF8( - PluginService::GetInstance()->GetPluginGroupName(*it)); + webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it)); if (name.empty()) name = *it; diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc index a9e327b..00843db 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc @@ -19,7 +19,6 @@ #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" #include "chrome/browser/ui/views/browser_dialogs.h" #include "chrome/browser/ui/views/bubble/bubble.h" -#include "content/browser/plugin_service.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" @@ -33,6 +32,7 @@ #include "views/controls/separator.h" #include "views/layout/grid_layout.h" #include "views/layout/layout_constants.h" +#include "webkit/plugins/npapi/plugin_list.h" #if defined(TOOLKIT_USES_GTK) #include "ui/gfx/gtk_util.h" @@ -217,7 +217,7 @@ void ContentSettingBubbleContents::InitControlLayout() { for (std::set<std::string>::const_iterator it = plugins.begin(); it != plugins.end(); ++it) { string16 name = - PluginService::GetInstance()->GetPluginGroupName(*it); + webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it); if (name.empty()) name = UTF8ToUTF16(*it); layout->StartRow(0, single_column_set_id); diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index f8141db..b7478fc 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -100,6 +100,8 @@ 'common/content_settings_types.h', 'common/custom_handlers/protocol_handler.cc', 'common/custom_handlers/protocol_handler.h', + 'common/default_plugin.cc', + 'common/default_plugin.h', 'common/extensions/extension.cc', 'common/extensions/extension.h', 'common/extensions/extension_action.cc', diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index 65b004b..a015b75 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc @@ -12,20 +12,17 @@ #include "base/stringprintf.h" #include "base/string_split.h" #include "base/string_util.h" -#include "base/utf_string_conversions.h" #include "base/win/windows_version.h" #include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/render_messages.h" -#include "chrome/default_plugin/plugin_main.h" #include "content/public/common/pepper_plugin_info.h" #include "remoting/client/plugin/pepper_entrypoints.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "webkit/glue/user_agent.h" -#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/plugin_constants.h" #if defined(OS_WIN) @@ -269,37 +266,6 @@ void ChromeContentClient::AddPepperPlugins( AddOutOfProcessFlash(plugins); } -void ChromeContentClient::AddNPAPIPlugins( - webkit::npapi::PluginList* plugin_list) { -#if defined(OS_WIN) && !defined(USE_AURA) - // TODO(bauerb): On Windows the default plug-in can download and install - // missing plug-ins, which we don't support in the browser yet, so keep - // using the default plug-in on Windows until we do. - // Aura isn't going to support NPAPI plugins. - const webkit::npapi::PluginEntryPoints entry_points = { - default_plugin::NP_GetEntryPoints, - default_plugin::NP_Initialize, - default_plugin::NP_Shutdown - }; - - webkit::WebPluginInfo info; - info.path = FilePath(webkit::npapi::kDefaultPluginLibraryName); - info.name = ASCIIToUTF16("Default Plug-in"); - info.version = ASCIIToUTF16("1"); - info.desc = ASCIIToUTF16("Provides functionality for installing third-party " - "plug-ins"); - - webkit::WebPluginMimeType mimeType; - mimeType.mime_type = "*"; - info.mime_types.push_back(mimeType); - - webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( - info, - entry_points, - false); -#endif -} - bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) { // Any Chrome-specific messages that must be allowed to be sent from swapped // out renderers. diff --git a/chrome/common/chrome_content_client.h b/chrome/common/chrome_content_client.h index 6c252e1..5d82037 100644 --- a/chrome/common/chrome_content_client.h +++ b/chrome/common/chrome_content_client.h @@ -21,8 +21,6 @@ class ChromeContentClient : 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; diff --git a/chrome/common/default_plugin.cc b/chrome/common/default_plugin.cc new file mode 100644 index 0000000..b9b8fab --- /dev/null +++ b/chrome/common/default_plugin.cc @@ -0,0 +1,44 @@ +// Copyright (c) 2011 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 "base/utf_string_conversions.h" +#include "chrome/common/default_plugin.h" +#include "chrome/default_plugin/plugin_main.h" +#include "webkit/plugins/npapi/plugin_list.h" + +namespace chrome { + +void RegisterInternalDefaultPlugin() { +#if defined(OS_WIN) && !defined(USE_AURA) + // TODO(bauerb): On Windows the default plug-in can download and install + // missing plug-ins, which we don't support in the browser yet, so keep + // using the default plug-in on Windows until we do. + // Aura isn't going to support NPAPI plugins. + const webkit::npapi::PluginEntryPoints entry_points = { +#if !defined(OS_POSIX) || defined(OS_MACOSX) + default_plugin::NP_GetEntryPoints, +#endif + default_plugin::NP_Initialize, + default_plugin::NP_Shutdown + }; + + webkit::WebPluginInfo info; + info.path = FilePath(webkit::npapi::kDefaultPluginLibraryName); + info.name = ASCIIToUTF16("Default Plug-in"); + info.version = ASCIIToUTF16("1"); + info.desc = ASCIIToUTF16("Provides functionality for installing third-party " + "plug-ins"); + + webkit::WebPluginMimeType mimeType; + mimeType.mime_type = "*"; + info.mime_types.push_back(mimeType); + + webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( + info, + entry_points, + false); +#endif +} + +} // namespace chrome diff --git a/chrome/common/default_plugin.h b/chrome/common/default_plugin.h new file mode 100644 index 0000000..6cc8348 --- /dev/null +++ b/chrome/common/default_plugin.h @@ -0,0 +1,16 @@ +// Copyright (c) 2010 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 CHROME_COMMON_DEFAULT_PLUGIN_H_ +#define CHROME_COMMON_DEFAULT_PLUGIN_H_ +#pragma once + +namespace chrome { + +// Register the default plugin as an internal plugin in the PluginList. +void RegisterInternalDefaultPlugin(); + +} // namespace chrome + +#endif // CHROME_COMMON_DEFAULT_PLUGIN_H_ diff --git a/chrome/plugin/chrome_content_plugin_client.cc b/chrome/plugin/chrome_content_plugin_client.cc index 0a8e42b..b26f523 100644 --- a/chrome/plugin/chrome_content_plugin_client.cc +++ b/chrome/plugin/chrome_content_plugin_client.cc @@ -4,6 +4,8 @@ #include "chrome/plugin/chrome_content_plugin_client.h" +#include "chrome/common/default_plugin.h" + #if defined(OS_MACOSX) #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" @@ -27,6 +29,8 @@ void ChromeContentPluginClient::PluginProcessStarted( cf_plugin_name.get(), app_name.get())); base::mac::SetProcessName(process_name); #endif + + chrome::RegisterInternalDefaultPlugin(); } } // namespace chrome 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; |