diff options
-rw-r--r-- | chrome/common/default_plugin.cc | 21 | ||||
-rw-r--r-- | webkit/plugins/npapi/plugin_list.cc | 32 | ||||
-rw-r--r-- | webkit/plugins/npapi/plugin_list.h | 17 |
3 files changed, 36 insertions, 34 deletions
diff --git a/chrome/common/default_plugin.cc b/chrome/common/default_plugin.cc index 26d95bf..b9b8fab 100644 --- a/chrome/common/default_plugin.cc +++ b/chrome/common/default_plugin.cc @@ -2,8 +2,8 @@ // 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" @@ -23,12 +23,21 @@ void RegisterInternalDefaultPlugin() { 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( - FilePath(webkit::npapi::kDefaultPluginLibraryName), - "Default Plug-in", - "Provides functionality for installing third-party plug-ins", - "*", - entry_points); + info, + entry_points, + false); #endif } diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc index 872144b..ccc91dd 100644 --- a/webkit/plugins/npapi/plugin_list.cc +++ b/webkit/plugins/npapi/plugin_list.cc @@ -231,26 +231,22 @@ void PluginList::RegisterInternalPlugin(const webkit::WebPluginInfo& info) { default_plugin_enabled_ = true; } -void PluginList::RegisterInternalPlugin(const FilePath& filename, - const std::string& name, - const std::string& description, - const std::string& mime_type_str, - const PluginEntryPoints& entry_points) { - InternalPlugin plugin; - plugin.info.path = filename; - plugin.info.name = ASCIIToUTF16(name); - plugin.info.version = ASCIIToUTF16("1"); - plugin.info.desc = ASCIIToUTF16(description); - - webkit::WebPluginMimeType mime_type; - mime_type.mime_type = mime_type_str; - plugin.info.mime_types.push_back(mime_type); - - plugin.entry_points = entry_points; +void PluginList::RegisterInternalPlugin(const webkit::WebPluginInfo& info, + const PluginEntryPoints& entry_points, + bool add_at_beginning) { + InternalPlugin plugin = { info, entry_points }; base::AutoLock lock(lock_); - internal_plugins_.push_back(plugin); - if (filename.value() == kDefaultPluginLibraryName) + + 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); + } else { + internal_plugins_.push_back(plugin); + } + + if (info.path.value() == kDefaultPluginLibraryName) default_plugin_enabled_ = true; } diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h index 1669251..847af14 100644 --- a/webkit/plugins/npapi/plugin_list.h +++ b/webkit/plugins/npapi/plugin_list.h @@ -85,16 +85,13 @@ class PluginList { // 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 metadata and - // the entry points. - // TODO(evan): we use file names here, but they're not really files, they're - // actually a string that uniquely identifies the plugin. - void RegisterInternalPlugin(const FilePath& filename, - const std::string& name, - const std::string& description, - const std::string& mime_type, - const PluginEntryPoints& entry_points); + // 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 + // 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); // Removes a specified internal plugin from the list. The search will match // on the path from the version info previously registered. |