diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-14 02:23:11 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-14 02:23:11 +0000 |
commit | c6f3deaa386fc63b64932cd296311f74a3c299db (patch) | |
tree | 15dd4243cf6a6953b1f7572dd7886f383577a607 /webkit/plugins | |
parent | 552c0a8a5e77a8f84a54f20b10d4d0c6c5155a6c (diff) | |
download | chromium_src-c6f3deaa386fc63b64932cd296311f74a3c299db.zip chromium_src-c6f3deaa386fc63b64932cd296311f74a3c299db.tar.gz chromium_src-c6f3deaa386fc63b64932cd296311f74a3c299db.tar.bz2 |
Keep "internal" and "extra" plugins in the same list.
This allows us to decide for every bundled plug-in whether it should override others.
BUG=110152
TEST=Flapper is loaded after NPAPI Flash.
Review URL: http://codereview.chromium.org/9204005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117763 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/npapi/plugin_list.cc | 40 | ||||
-rw-r--r-- | webkit/plugins/npapi/plugin_list.h | 17 |
2 files changed, 23 insertions, 34 deletions
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. // |