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

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: Plugin reloading works completely now. Lint made happy as well. 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..890984fb72ac64b351479dcb29bedab4afc219ca 100644
--- a/webkit/glue/plugins/plugin_list.h
+++ b/webkit/glue/plugins/plugin_list.h
@@ -5,8 +5,10 @@
#ifndef WEBKIT_GLUE_PLUGINS_PLUGIN_LIST_H_
#define WEBKIT_GLUE_PLUGINS_PLUGIN_LIST_H_
+#include <map>
#include <set>
#include <string>
+#include <utility>
#include <vector>
#include "base/basictypes.h"
@@ -71,6 +73,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();
@@ -183,7 +191,7 @@ class PluginList {
// Load a specific plugin with full path.
void LoadPlugin(const FilePath& filename,
- std::vector<WebPluginInfo>* plugins);
+ std::vector<WebPluginInfo*>* plugins);
// 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 +203,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,7 +220,11 @@ class PluginList {
// version.
void DisableOutdatedPluginGroups();
- ~PluginList();
+ const DisabledPlugins& GetDisabledPlugins() const;
+
+ const DisabledGroups& GetDisabledGroups() const;
+
+ virtual ~PluginList();
private:
FRIEND_TEST_ALL_PREFIXES(PluginGroupTest, PluginGroupDefinition);
@@ -226,7 +239,8 @@ class PluginList {
// 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);
+ PluginGroup* AddToPluginGroups(const WebPluginInfo& web_plugin_info,
+ std::vector<WebPluginInfo*>* plugins);
// Load all plugins from the default plugins directory
void LoadPlugins(bool refresh);
@@ -236,14 +250,14 @@ 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::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);
+ std::vector<WebPluginInfo*>* plugins);
// 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,8 +300,8 @@ class PluginList {
// Loads plugins registered under HKCU\Software\MozillaPlugins and
// HKLM\Software\MozillaPlugins.
- void LoadPluginsFromRegistry(std::vector<WebPluginInfo>* plugins,
- std::set<FilePath>* visited_plugins);
+ void LoadPluginsFromRegistry(std::set<FilePath>* visited_plugins,
+ std::vector<WebPluginInfo*>* plugins);
#endif
//
@@ -300,7 +314,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 +325,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 +344,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