Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: webkit/glue/plugins/plugin_list.h

Issue 5699005: Policy: Re-enabled plugin still disabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed PluginGroup::DisableOutdatedPlugins Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/glue/plugins/plugin_list.h
diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h
index 734cc6d7286693456b0704c2b5711190cba81e1c..8f11a5e0e25ca3d4551ed223ec9ab707390fdfd1 100644
--- a/webkit/glue/plugins/plugin_list.h
+++ b/webkit/glue/plugins/plugin_list.h
@@ -71,6 +71,12 @@ struct PluginVersionInfo {
// This object is thread safe.
class PluginList {
public:
+ // Enum of possible reasons for plugin or group being disabled. Used in the
+ // |disabled_plugins_| and |disabled_groups_| maps.
+ enum PluginDisabledReason { USER = 0, POLICY, POLICY_AND_USER };
+ typedef std::map<FilePath, PluginDisabledReason> DisabledPlugins;
+ typedef std::map<string16, PluginDisabledReason> DisabledGroups;
+
// Gets the one instance of the PluginList.
static PluginList* Singleton();
@@ -182,8 +188,7 @@ class PluginList {
std::string GetPluginGroupIdentifier(const WebPluginInfo& web_plugin_info);
// Load a specific plugin with full path.
- void LoadPlugin(const FilePath& filename,
- std::vector<WebPluginInfo>* plugins);
+ void LoadPlugin(const FilePath& filename);
// Enable a specific plugin, specified by path. Returns |true| iff a plugin
// currently in the plugin list was actually enabled as a result; regardless
@@ -195,8 +200,9 @@ class PluginList {
// 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. The boolean flag should be set to true if the plugin is
+ // disabled by a policy and not a user.
+ bool DisablePlugin(const FilePath& filename, bool policy_disabled);
// 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
@@ -211,6 +217,10 @@ class PluginList {
// version.
void DisableOutdatedPluginGroups();
+ const DisabledPlugins& GetDisabledPlugins() const;
+
+ const DisabledGroups& GetDisabledGroups() const;
+
~PluginList();
private:
@@ -236,14 +246,12 @@ class PluginList {
// |visited_plugins| is updated with paths to all plugins that were considered
// (including those we didn't load)
void LoadPluginsFromDir(const FilePath& path,
- std::vector<WebPluginInfo>* plugins,
std::set<FilePath>* visited_plugins);
// Returns true if we should load the given plugin, or false otherwise.
// plugins is the list of plugins we have crawled in the current plugin
// loading run.
- bool ShouldLoadPlugin(const WebPluginInfo& info,
- std::vector<WebPluginInfo>* plugins);
+ bool ShouldLoadPlugin(const WebPluginInfo& info);
// Return whether a plug-in group with the given name should be disabled,
// either because it already is on the list of disabled groups, or because it
@@ -286,7 +294,7 @@ class PluginList {
// Loads plugins registered under HKCU\Software\MozillaPlugins and
// HKLM\Software\MozillaPlugins.
- void LoadPluginsFromRegistry(std::vector<WebPluginInfo>* plugins,
+ void LoadPluginsFromRegistry(std::vector<WebPluginInfo*>* plugins,
std::set<FilePath>* visited_plugins);
#endif
@@ -300,7 +308,7 @@ class PluginList {
bool plugins_need_refresh_;
// Contains information about the available plugins.
- std::vector<WebPluginInfo> plugins_;
+ std::vector<WebPluginInfo*> plugins_;
// Extra plugin paths that we want to search when loading.
std::vector<FilePath> extra_plugin_paths_;
@@ -311,11 +319,15 @@ class PluginList {
// Holds information about internal plugins.
std::vector<PluginVersionInfo> internal_plugins_;
+ // An element of the disabled list saves the reason for being disabled in the
+ // second element of the pair.
+ typedef std::pair<FilePath, PluginDisabledReason> DisabledPluginsListElement;
// Path names of plugins to disable (the default is to enable them all).
- std::set<FilePath> disabled_plugins_;
+ DisabledPlugins disabled_plugins_;
+ typedef std::pair<string16, PluginDisabledReason> DisabledGroupsListElement;
// Group names to disable (the default is to enable them all).
- std::set<string16> disabled_groups_;
+ DisabledGroups disabled_groups_;
bool disable_outdated_plugins_;
@@ -326,7 +338,7 @@ class PluginList {
// 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>;

Powered by Google App Engine
This is Rietveld 408576698