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

Unified Diff: webkit/plugins/npapi/plugin_group.h

Issue 7901015: Revert 101269 - Store plug-in enabled/disabled state in PluginPrefs instead of WebPluginInfo, to ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months 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
« no previous file with comments | « content/common/view_messages.h ('k') | webkit/plugins/npapi/plugin_group.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/npapi/plugin_group.h
===================================================================
--- webkit/plugins/npapi/plugin_group.h (revision 101271)
+++ webkit/plugins/npapi/plugin_group.h (working copy)
@@ -6,6 +6,8 @@
#define WEBKIT_PLUGINS_NPAPI_PLUGIN_GROUP_H_
#pragma once
+#include <map>
+#include <set>
#include <string>
#include <vector>
@@ -95,6 +97,24 @@
PluginGroup& operator=(const PluginGroup& other);
+ // Configures the set of plugin name patterns for enabling and disabling
+ // plugins via enterprise configuration management.
+ static void SetPolicyEnforcedPluginPatterns(
+ const std::set<string16>& plugins_disabled,
+ const std::set<string16>& plugins_disabled_exceptions,
+ const std::set<string16>& plugins_enabled);
+
+ // Tests whether |plugin_name| is disabled by policy.
+ static bool IsPluginNameDisabledByPolicy(const string16& plugin_name);
+
+ // Tests whether |plugin_name| within the plugin group |group_name| is
+ // disabled by policy.
+ static bool IsPluginFileNameDisabledByPolicy(const string16& plugin_name,
+ const string16& group_name);
+
+ // Tests whether |plugin_name| is enabled by policy.
+ static bool IsPluginNameEnabledByPolicy(const string16& plugin_name);
+
// Returns true if the given plugin matches this group.
bool Match(const webkit::WebPluginInfo& plugin) const;
@@ -104,6 +124,24 @@
// Removes a plugin from the group by its path.
bool RemovePlugin(const FilePath& filename);
+ // The two following functions enable/disable a plugin given its filename. The
+ // function returns true if the plugin could be enabled/disabled. Plugins
+ // might not get enabled/disabled if they are controlled by policy or are
+ // already in the wanted state.
+ bool EnablePlugin(const FilePath& filename);
+ bool DisablePlugin(const FilePath& filename);
+
+ // Enables/disables this group. This enables/disables all plugins in the
+ // group.
+ bool EnableGroup(bool enable);
+
+ // Checks whether the group should be disabled/enabled by a policy and puts
+ // it in the needed state. Updates all contained plugins too.
+ void EnforceGroupPolicy();
+
+ // Returns whether the plugin group is enabled or not.
+ bool Enabled() const { return enabled_; }
+
// Returns a unique identifier for this group, if one is defined, or the empty
// string otherwise.
const std::string& identifier() const { return identifier_; }
@@ -117,21 +155,36 @@
// is empty.
string16 GetGroupName() const;
+ // Returns all plugins added to the group.
+ const std::vector<webkit::WebPluginInfo>& web_plugins_info() const {
+ return web_plugin_infos_;
+ }
+
// Checks whether a plugin exists in the group with the given path.
bool ContainsPlugin(const FilePath& path) const;
+ // Returns the description of the highest-priority plug-in in the group.
+ const string16& description() const { return description_; }
+
+ // Returns a DictionaryValue with data to display in the UI.
+ base::DictionaryValue* GetDataForUI() const;
+
+ // Returns a DictionaryValue with data to save in the preferences.
+ base::DictionaryValue* GetSummary() const;
+
// Returns the update URL.
std::string GetUpdateURL() const { return update_url_; }
// Returns true if this plugin group is whitelisted.
bool IsWhitelisted() const;
- // Returns true if |plugin| in this group has known security problems.
- bool IsVulnerable(const WebPluginInfo& plugin) const;
+ // Returns true if the highest-priority plugin in this group has known
+ // security problems.
+ bool IsVulnerable() const;
- // Returns true if |plugin| in this plug-in group always requires user
- // authorization to run.
- bool RequiresAuthorization(const WebPluginInfo& plugin) const;
+ // Returns true if this plug-in group always requires user authorization
+ // to run.
+ bool RequiresAuthorization() const;
// Check if the group has no plugins. Could happen after a reload if the plug-
// in has disappeared from the pc (or in the process of updating).
@@ -141,7 +194,7 @@
// in accepting weird version strings than Version::GetFromString().
static Version* CreateVersionFromString(const string16& version_string);
- const std::vector<webkit::WebPluginInfo>& web_plugin_infos() const {
+ std::vector<webkit::WebPluginInfo> web_plugin_infos() {
return web_plugin_infos_;
}
@@ -184,17 +237,54 @@
void InitFrom(const PluginGroup& other);
+ // Set the description and version for this plugin group from the
+ // given plug-in.
+ void UpdateDescriptionAndVersion(const webkit::WebPluginInfo& plugin);
+
+ // Updates the active plugin in the group. The active plugin is the first
+ // enabled one, or if all plugins are disabled, simply the first one.
+ void UpdateActivePlugin(const webkit::WebPluginInfo& plugin);
+
+ // Resets the group state to its default value (as if the group was empty).
+ // After calling this method, calling |UpdateActivePlugin| with all plugins
+ // in a row will correctly set the group state.
+ void ResetGroupState();
+
+ // Enables the plugin if not already enabled and if policy allows it to.
+ // Returns true on success. Does not update the group state.
+ static bool Enable(webkit::WebPluginInfo* plugin, int reason);
+
+ // Disables the plugin if not already disabled and if policy allows it to.
+ // Returns true on success. Does not update the group state.
+ static bool Disable(webkit::WebPluginInfo* plugin, int reason);
+
+ // Helper function to implement the functions above.
+ static bool SetPluginState(webkit::WebPluginInfo* plugin,
+ int new_reason,
+ bool state_changes);
+
// Returns a non-const vector of all plugins in the group. This is only used
// by PluginList.
std::vector<webkit::WebPluginInfo>& GetPluginsContainer() {
return web_plugin_infos_;
}
+ // Checks if |name| matches any of the patterns in |pattern_set|.
+ static bool IsStringMatchedInSet(const string16& name,
+ const std::set<string16>* pattern_set);
+
+ static std::set<string16>* policy_disabled_plugin_patterns_;
+ static std::set<string16>* policy_disabled_plugin_exception_patterns_;
+ static std::set<string16>* policy_enabled_plugin_patterns_;
+
std::string identifier_;
string16 group_name_;
string16 name_matcher_;
+ string16 description_;
std::string update_url_;
+ bool enabled_;
std::vector<VersionRange> version_ranges_;
+ scoped_ptr<Version> version_;
std::vector<webkit::WebPluginInfo> web_plugin_infos_;
};
Property changes on: webkit/plugins/npapi/plugin_group.h
___________________________________________________________________
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/src/webkit/plugins/npapi/plugin_group.h:r3734-4217,4606-5108,5177-5263
« no previous file with comments | « content/common/view_messages.h ('k') | webkit/plugins/npapi/plugin_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698