diff options
Diffstat (limited to 'chrome/common/plugin_group.h')
-rw-r--r-- | chrome/common/plugin_group.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/chrome/common/plugin_group.h b/chrome/common/plugin_group.h index 62f5b6f..9691dd7 100644 --- a/chrome/common/plugin_group.h +++ b/chrome/common/plugin_group.h @@ -6,6 +6,7 @@ #define CHROME_COMMON_PLUGIN_GROUP_H_ #pragma once +#include <map> #include <set> #include <vector> @@ -23,6 +24,7 @@ class linked_ptr; // Hard-coded definitions of plugin groups. struct PluginGroupDefinition { + const char* identifier; // Unique identifier for this group. const char* name; // Name of this group. const char* name_matcher; // Substring matcher for the plugin name. const char* version_matcher_low; // Matchers for the plugin version. @@ -40,6 +42,8 @@ struct PluginGroupDefinition { class PluginGroup { public: + typedef std::map<std::string, linked_ptr<PluginGroup> > PluginMap; + // Creates a PluginGroup from a PluginGroupDefinition. static PluginGroup* FromPluginGroupDefinition( const PluginGroupDefinition& definition); @@ -53,7 +57,8 @@ class PluginGroup { // Find a plugin group matching |info| in the list of hardcoded plugins and // returns a copy of it if found, or a new group matching exactly this plugin // otherwise. - static PluginGroup* FindHardcodedPluginGroup(const WebPluginInfo& info); + // The caller should take ownership of the return PluginGroup. + static PluginGroup* CopyOrCreatePluginGroup(const WebPluginInfo& info); // Configures the set of plugin name patterns for disabling plugins via // enterprise configuration management. @@ -70,14 +75,14 @@ class PluginGroup { // Find the PluginGroup matching a Plugin in a list of plugin groups. Returns // NULL if no matching PluginGroup is found. static PluginGroup* FindGroupMatchingPlugin( - std::vector<linked_ptr<PluginGroup> >& plugin_groups, + const std::map<std::string, linked_ptr<PluginGroup> >& plugin_groups, const WebPluginInfo& plugin); // Creates a copy of this plugin group. PluginGroup* Copy() { return new PluginGroup(group_name_, name_matcher_, version_range_low_str_, version_range_high_str_, min_version_str_, - update_url_); + update_url_, identifier_); } // Returns true if the given plugin matches this group. @@ -94,6 +99,10 @@ class PluginGroup { // 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_; } + // Returns this group's name, or the filename without extension if the name // is empty. string16 GetGroupName() const; @@ -129,7 +138,8 @@ class PluginGroup { const std::string& version_range_low, const std::string& version_range_high, const std::string& min_version, - const std::string& update_url); + const std::string& update_url, + const std::string& identifier); Version* CreateVersionFromString(const string16& version_string); @@ -143,6 +153,7 @@ class PluginGroup { static std::set<string16>* policy_disabled_plugin_patterns_; + std::string identifier_; string16 group_name_; string16 name_matcher_; std::string version_range_low_str_; |