| Index: webkit/plugins/npapi/plugin_list.h
|
| diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h
|
| index 94124a29856f145e1c71783c01f86b6af5b8030f..f16bea3b7d7b3ae89613b8a4a012b2651c562366 100644
|
| --- a/webkit/plugins/npapi/plugin_list.h
|
| +++ b/webkit/plugins/npapi/plugin_list.h
|
| @@ -5,8 +5,10 @@
|
| #ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_
|
| #define WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_
|
|
|
| +#include <map>
|
| #include <set>
|
| #include <string>
|
| +#include <utility>
|
| #include <vector>
|
|
|
| #include "base/basictypes.h"
|
| @@ -188,21 +190,23 @@ class PluginList {
|
| // Enable a specific plugin, specified by path. Returns |true| iff a plugin
|
| // currently in the plugin list was actually enabled as a result; regardless
|
| // of return value, if a plugin is found in the future with the given name, it
|
| - // will be enabled. Note that plugins are enabled by default as far as
|
| - // |PluginList| is concerned.
|
| - bool EnablePlugin(const FilePath& filename);
|
| + // will be enabled. |name| must be specified if EnablePlugin can be called
|
| + // for a plugin that is not yet loaded, which is the case when setting plugins
|
| + // as enabled by policy.
|
| + bool EnablePlugin(const FilePath& filename, const string16& name);
|
|
|
| // Disable a specific plugin, specified by path. Returns |true| iff a plugin
|
| // currently in the plugin list was actually disabled as a result; regardless
|
| // of return value, if a plugin is found in the future with the given name, it
|
| - // will be disabled.
|
| - bool DisablePlugin(const FilePath& filename);
|
| + // will be disabled. |name| must be specified if EnablePlugin can be called
|
| + // for a plugin that is not yet loaded. Especially true when setting plugins
|
| + // as enabled b policy.
|
| + bool DisablePlugin(const FilePath& filename, const string16& name);
|
|
|
| // Enable/disable a plugin group, specified by group_name. Returns |true| iff
|
| // a plugin currently in the plugin list was actually enabled/disabled as a
|
| // result; regardless of return value, if a plugin is found in the future with
|
| - // the given name, it will be enabled/disabled. Note that plugins are enabled
|
| - // by default as far as |PluginList| is concerned.
|
| + // the given name, it will be enabled/disabled.
|
| bool EnableGroup(bool enable, const string16& name);
|
|
|
| // Disable all plugins groups that are known to be outdated, according to
|
| @@ -211,25 +215,44 @@ class PluginList {
|
| // version.
|
| void DisableOutdatedPluginGroups();
|
|
|
| - ~PluginList();
|
| -
|
| - private:
|
| - FRIEND_TEST_ALL_PREFIXES(PluginGroupTest, PluginGroupDefinition);
|
| + virtual ~PluginList();
|
|
|
| + protected:
|
| // Constructors are private for singletons
|
| PluginList();
|
|
|
| - // Creates PluginGroups for the static group definitions, and adds them to
|
| - // the PluginGroup cache of this PluginList.
|
| - void AddHardcodedPluginGroups();
|
| + // Load all plugins from the default plugins directory
|
| + virtual void LoadPlugins(bool refresh);
|
| +
|
| + // Allows tests to perform custom post-initialization tasks on newly created
|
| + // PluginGroups.
|
| + virtual void ProcessGroupAfterInitialize(PluginGroup* group) { }
|
|
|
| // Adds the given WebPluginInfo to its corresponding group, creating it if
|
| // necessary, and returns the group.
|
| // Callers need to protect calls to this method by a lock themselves.
|
| PluginGroup* AddToPluginGroups(const WebPluginInfo& web_plugin_info);
|
|
|
| - // Load all plugins from the default plugins directory
|
| - void LoadPlugins(bool refresh);
|
| + bool plugins_loaded_;
|
| +
|
| + // Holds the currently available plugin groups.
|
| + PluginGroup::PluginMap plugin_groups_;
|
| +
|
| + private:
|
| + FRIEND_TEST_ALL_PREFIXES(PluginGroupTest, PluginGroupDefinition);
|
| +
|
| + // Creates PluginGroups for the static group definitions, and adds them to
|
| + // the PluginGroup cache of this PluginList.
|
| + void AddHardcodedPluginGroups();
|
| +
|
| + // Adds the Plugin given by its path and name to its corresponding group,
|
| + // creating it if necessary, and returns the group. this function can be
|
| + // called for plugins not yet registered in the system. It will create a
|
| + // placeholder until the complete information can be added with a call to
|
| + // AddToPluginGroup.
|
| + // Callers need to protect calls to this method by a lock themselves.
|
| + PluginGroup* AddPlaceholderToPluginGroups(const FilePath& filename,
|
| + const string16& name);
|
|
|
| // Load all plugins from a specific directory.
|
| // |plugins| is updated with loaded plugin information.
|
| @@ -251,21 +274,6 @@ class PluginList {
|
| // list of disabled groups as well.
|
| bool ShouldDisableGroup(const string16& group_name);
|
|
|
| - // Returns true if the given WebPluginInfo supports "mime-type".
|
| - // mime_type should be all lower case.
|
| - static bool SupportsType(const WebPluginInfo& info,
|
| - const std::string &mime_type,
|
| - bool allow_wildcard);
|
| -
|
| - // Returns true if the given WebPluginInfo supports a given file extension.
|
| - // extension should be all lower case.
|
| - // If mime_type is not NULL, it will be set to the mime type if found.
|
| - // The mime type which corresponds to the extension is optionally returned
|
| - // back.
|
| - static bool SupportsExtension(const WebPluginInfo& info,
|
| - const std::string &extension,
|
| - std::string* actual_mime_type);
|
| -
|
| //
|
| // Platform functions
|
| //
|
| @@ -294,14 +302,9 @@ class PluginList {
|
| // Internals
|
| //
|
|
|
| - bool plugins_loaded_;
|
| -
|
| // If true, we reload plugins even if they've been loaded already.
|
| bool plugins_need_refresh_;
|
|
|
| - // Contains information about the available plugins.
|
| - std::vector<WebPluginInfo> plugins_;
|
| -
|
| // Extra plugin paths that we want to search when loading.
|
| std::vector<FilePath> extra_plugin_paths_;
|
|
|
| @@ -311,22 +314,13 @@ class PluginList {
|
| // Holds information about internal plugins.
|
| std::vector<PluginVersionInfo> internal_plugins_;
|
|
|
| - // Path names of plugins to disable (the default is to enable them all).
|
| - std::set<FilePath> disabled_plugins_;
|
| -
|
| - // Group names to disable (the default is to enable them all).
|
| - std::set<string16> disabled_groups_;
|
| -
|
| bool disable_outdated_plugins_;
|
|
|
| - // Holds the currently available plugin groups.
|
| - PluginGroup::PluginMap plugin_groups_;
|
| -
|
| int next_priority_;
|
|
|
| // Need synchronization for the above members since this object can be
|
| // accessed on multiple threads.
|
| - Lock lock_;
|
| + mutable Lock lock_;
|
|
|
| friend struct base::DefaultLazyInstanceTraits<PluginList>;
|
|
|
|
|