diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-21 01:44:30 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-21 01:44:30 +0000 |
commit | 367230c507ce20ff3b42013d0a3eac4ee01efb88 (patch) | |
tree | b217eb19f3c5f662debd5fb562b028d427c3ae19 /webkit/glue/plugins | |
parent | 52fadc8176f4076cc021c15d9ccc022e17fd8e97 (diff) | |
download | chromium_src-367230c507ce20ff3b42013d0a3eac4ee01efb88.zip chromium_src-367230c507ce20ff3b42013d0a3eac4ee01efb88.tar.gz chromium_src-367230c507ce20ff3b42013d0a3eac4ee01efb88.tar.bz2 |
Add NPAPI plugins contained in extensions to the PluginList.
Review URL: http://codereview.chromium.org/20521
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r-- | webkit/glue/plugins/plugin_list.cc | 20 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list.h | 10 |
2 files changed, 26 insertions, 4 deletions
diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc index 3f308d6..a2e369e 100644 --- a/webkit/glue/plugins/plugin_list.cc +++ b/webkit/glue/plugins/plugin_list.cc @@ -36,17 +36,25 @@ PluginList* PluginList::Singleton() { } // static -void PluginList::AddExtraPluginPath(const FilePath& plugin_path) { +void PluginList::ResetPluginsLoaded() { // We access the singleton directly, and not through Singleton(), since // we don't want LoadPlugins() to be called. - DCHECK(!g_singleton.Pointer()->plugins_loaded_); + g_singleton.Pointer()->plugins_loaded_ = false; +} +// static +void PluginList::AddExtraPluginPath(const FilePath& plugin_path) { + DCHECK(!g_singleton.Pointer()->plugins_loaded_); g_singleton.Pointer()->extra_plugin_paths_.push_back(plugin_path); } +// static +void PluginList::AddExtraPluginDir(const FilePath& plugin_dir) { + DCHECK(!g_singleton.Pointer()->plugins_loaded_); + g_singleton.Pointer()->extra_plugin_dirs_.push_back(plugin_dir); +} + void PluginList::RegisterInternalPlugin(const PluginVersionInfo& info) { - // We access the singleton directly, and not through Singleton(), since - // we don't want LoadPlugins() to be called. DCHECK(!g_singleton.Pointer()->plugins_loaded_); g_singleton.Pointer()->internal_plugins_.push_back(info); } @@ -157,6 +165,10 @@ void PluginList::LoadPlugins(bool refresh) { LoadPluginsFromDir(directories_to_scan[i]); } + for (size_t i = 0; i < extra_plugin_dirs_.size(); ++i) { + LoadPluginsFromDir(extra_plugin_dirs_[i]); + } + for (size_t i = 0; i < extra_plugin_paths_.size(); ++i) LoadPlugin(extra_plugin_paths_[i]); diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h index d64131e..3b7b84a 100644 --- a/webkit/glue/plugins/plugin_list.h +++ b/webkit/glue/plugins/plugin_list.h @@ -75,11 +75,18 @@ class PluginList { // the first time. static PluginList* Singleton(); + // Clear the plugins_loaded_ bit to force a refresh next time we retrieve + // plugins. + static void ResetPluginsLoaded(); + // Add an extra plugin to load when we actually do the loading. This is // static because we want to be able to add to it without searching the disk // for plugins. Must be called before the plugins have been loaded. static void AddExtraPluginPath(const FilePath& plugin_path); + // Same as above, but specifies a directory in which to search for plugins. + static void AddExtraPluginDir(const FilePath& plugin_dir); + // Register an internal plugin with the specified plugin information and // function pointers. An internal plugin must be registered before it can // be loaded using PluginList::LoadPlugin(). @@ -204,6 +211,9 @@ class PluginList { // Extra plugin paths that we want to search when loading. std::vector<FilePath> extra_plugin_paths_; + // Extra plugin directories that we want to search when loading. + std::vector<FilePath> extra_plugin_dirs_; + // Holds information about internal plugins. std::vector<PluginVersionInfo> internal_plugins_; |