diff options
-rw-r--r-- | chrome/browser/browser_process_impl.cc | 2 | ||||
-rw-r--r-- | chrome/browser/component_updater/pepper_flash_component_installer.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_service.cc | 2 | ||||
-rw-r--r-- | chrome/common/chrome_content_client.cc | 8 | ||||
-rw-r--r-- | content/browser/plugin_service_impl.cc | 11 | ||||
-rw-r--r-- | content/browser/plugin_service_impl.h | 3 | ||||
-rw-r--r-- | content/public/browser/plugin_service.h | 6 | ||||
-rw-r--r-- | webkit/plugins/npapi/plugin_list.cc | 40 | ||||
-rw-r--r-- | webkit/plugins/npapi/plugin_list.h | 17 |
9 files changed, 43 insertions, 48 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index f68f0f2..cf139193 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -746,7 +746,7 @@ void BrowserProcessImpl::PreMainMessageLoopRun() { // 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")); + plugin_service->AddExtraPluginDir(user_data_dir.Append("Plugins")); } #endif diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc index ac4e905..6d35fc2 100644 --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc @@ -177,7 +177,7 @@ void RegisterPepperFlashWithChrome(const FilePath& path, PluginPrefs::EnablePluginGlobally(IsPepperFlashEnabledByDefault(), plugin_info.path); PluginService::GetInstance()->RegisterInternalPlugin( - plugin_info.ToWebPluginInfo()); + plugin_info.ToWebPluginInfo(), false); PluginService::GetInstance()->RefreshPlugins(); } diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index c69cd61..0c42e67 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -2583,7 +2583,7 @@ void ExtensionService::UpdatePluginListWithNaClModules() { } PluginService::GetInstance()->RefreshPlugins(); - PluginService::GetInstance()->RegisterInternalPlugin(info); + PluginService::GetInstance()->RegisterInternalPlugin(info, true); // This plugin has been modified, no need to check the rest of its // types, but continue checking other plugins. break; diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index 12a3d02..58c5584 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -338,10 +338,8 @@ void ChromeContentClient::AddNPAPIPlugins( mimeType.mime_type = "*"; info.mime_types.push_back(mimeType); - webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( - info, - entry_points, - false); + webkit::npapi::PluginList::Singleton()->RegisterInternalPluginWithEntryPoints( + info, false, entry_points); #endif } diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc index 4dcc47c..84734d5f 100644 --- a/content/browser/plugin_service_impl.cc +++ b/content/browser/plugin_service_impl.cc @@ -590,7 +590,7 @@ void PluginServiceImpl::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()); + RegisterInternalPlugin(ppapi_plugins_[i].ToWebPluginInfo(), true); } } @@ -648,6 +648,10 @@ void PluginServiceImpl::AddExtraPluginPath(const FilePath& path) { plugin_list_->AddExtraPluginPath(path); } +void PluginServiceImpl::AddExtraPluginDir(const FilePath& path) { + plugin_list_->AddExtraPluginDir(path); +} + void PluginServiceImpl::RemoveExtraPluginPath(const FilePath& path) { plugin_list_->RemoveExtraPluginPath(path); } @@ -662,8 +666,9 @@ void PluginServiceImpl::SetPluginListForTesting( } void PluginServiceImpl::RegisterInternalPlugin( - const webkit::WebPluginInfo& info) { - plugin_list_->RegisterInternalPlugin(info); + const webkit::WebPluginInfo& info, + bool add_at_beginning) { + plugin_list_->RegisterInternalPlugin(info, add_at_beginning); } string16 PluginServiceImpl::GetPluginGroupName(const std::string& plugin_name) { diff --git a/content/browser/plugin_service_impl.h b/content/browser/plugin_service_impl.h index a9aee11..fc96968 100644 --- a/content/browser/plugin_service_impl.h +++ b/content/browser/plugin_service_impl.h @@ -97,10 +97,11 @@ class CONTENT_EXPORT PluginServiceImpl virtual content::PluginServiceFilter* GetFilter() OVERRIDE; virtual void RefreshPlugins() OVERRIDE; virtual void AddExtraPluginPath(const FilePath& path) OVERRIDE; + virtual void AddExtraPluginDir(const FilePath& path) OVERRIDE; virtual void RemoveExtraPluginPath(const FilePath& path) OVERRIDE; virtual void UnregisterInternalPlugin(const FilePath& path) OVERRIDE; virtual void RegisterInternalPlugin( - const webkit::WebPluginInfo& info) OVERRIDE; + const webkit::WebPluginInfo& info, bool add_at_beginning) OVERRIDE; virtual string16 GetPluginGroupName(const std::string& plugin_name) OVERRIDE; virtual webkit::npapi::PluginList* GetPluginList() OVERRIDE; virtual void SetPluginListForTesting( diff --git a/content/public/browser/plugin_service.h b/content/public/browser/plugin_service.h index ee01e06..9a7985a 100644 --- a/content/public/browser/plugin_service.h +++ b/content/public/browser/plugin_service.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -123,9 +123,11 @@ class PluginService { // PluginList for further documentation of these functions. virtual void RefreshPlugins() = 0; virtual void AddExtraPluginPath(const FilePath& path) = 0; + virtual void AddExtraPluginDir(const FilePath& path) = 0; virtual void RemoveExtraPluginPath(const FilePath& path) = 0; virtual void UnregisterInternalPlugin(const FilePath& path) = 0; - virtual void RegisterInternalPlugin(const webkit::WebPluginInfo& info) = 0; + virtual void RegisterInternalPlugin(const webkit::WebPluginInfo& info, + bool add_at_beginning) = 0; virtual string16 GetPluginGroupName(const std::string& plugin_name) = 0; // TODO(dpranke): This should be private. diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc index f12ce5c..0f9e4cf 100644 --- a/webkit/plugins/npapi/plugin_list.cc +++ b/webkit/plugins/npapi/plugin_list.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -246,32 +246,27 @@ void PluginList::AddExtraPluginDir(const FilePath& plugin_dir) { #endif } -void PluginList::RegisterInternalPlugin(const webkit::WebPluginInfo& info) { +void PluginList::RegisterInternalPlugin(const webkit::WebPluginInfo& info, + bool add_at_beginning) { PluginEntryPoints entry_points = {0}; - InternalPlugin plugin = { info, entry_points }; - - base::AutoLock lock(lock_); - // Newer registrations go earlier in the list so they can override the MIME - // types of older registrations. - internal_plugins_.insert(internal_plugins_.begin(), plugin); - - if (info.path.value() == kDefaultPluginLibraryName) - default_plugin_enabled_ = true; + RegisterInternalPluginWithEntryPoints(info, add_at_beginning, entry_points); } -void PluginList::RegisterInternalPlugin(const webkit::WebPluginInfo& info, - const PluginEntryPoints& entry_points, - bool add_at_beginning) { +void PluginList::RegisterInternalPluginWithEntryPoints( + const webkit::WebPluginInfo& info, + bool add_at_beginning, + const PluginEntryPoints& entry_points) { InternalPlugin plugin = { info, entry_points }; base::AutoLock lock(lock_); + internal_plugins_.push_back(plugin); if (add_at_beginning) { // Newer registrations go earlier in the list so they can override the MIME // types of older registrations. - internal_plugins_.insert(internal_plugins_.begin(), plugin); + extra_plugin_paths_.insert(extra_plugin_paths_.begin(), info.path); } else { - internal_plugins_.push_back(plugin); + extra_plugin_paths_.push_back(info.path); } if (info.path.value() == kDefaultPluginLibraryName) @@ -465,32 +460,23 @@ void PluginList::GetPluginPathsToLoad(std::vector<FilePath>* plugin_paths) { // other methods if they're called on other threads. std::vector<FilePath> extra_plugin_paths; std::vector<FilePath> extra_plugin_dirs; - std::vector<InternalPlugin> internal_plugins; { base::AutoLock lock(lock_); extra_plugin_paths = extra_plugin_paths_; extra_plugin_dirs = extra_plugin_dirs_; - internal_plugins = internal_plugins_; } std::vector<FilePath> directories_to_scan; GetPluginDirectories(&directories_to_scan); - // Load internal plugins first so that, if both an internal plugin and a - // "discovered" plugin want to handle the same type, the internal plugin - // will have precedence. - for (size_t i = 0; i < internal_plugins.size(); ++i) { - if (internal_plugins[i].info.path.value() == kDefaultPluginLibraryName) - continue; - plugin_paths->push_back(internal_plugins[i].info.path); - } - for (size_t i = 0; i < extra_plugin_paths.size(); ++i) { const FilePath& path = extra_plugin_paths[i]; if (std::find(plugin_paths->begin(), plugin_paths->end(), path) != plugin_paths->end()) { continue; } + if (path.value() == kDefaultPluginLibraryName) + continue; plugin_paths->push_back(path); } diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h index 83822e7..e0df428 100644 --- a/webkit/plugins/npapi/plugin_list.h +++ b/webkit/plugins/npapi/plugin_list.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -82,16 +82,19 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // Register an internal plugin with the specified plugin information. // An internal plugin must be registered before it can // be loaded using PluginList::LoadPlugin(). - void RegisterInternalPlugin(const webkit::WebPluginInfo& info); - - // This second version is for "plugins" that have been compiled directly into - // the binary -- callers must provide the plugin information and the entry - // points. If |add_at_beginning| is true the plugin will be added earlier in + // If |add_at_beginning| is true the plugin will be added earlier in // the list so that it can override the MIME types of older registrations. void RegisterInternalPlugin(const webkit::WebPluginInfo& info, - const PluginEntryPoints& entry_points, bool add_at_beginning); + // This second version is for "plugins" that have been compiled directly into + // the binary -- callers must provide the plugin information and the entry + // points. + void RegisterInternalPluginWithEntryPoints( + const webkit::WebPluginInfo& info, + bool add_at_beginning, + const PluginEntryPoints& entry_points); + // Removes a specified internal plugin from the list. The search will match // on the path from the version info previously registered. // |