Chromium Code Reviews| Index: webkit/glue/plugins/plugin_group.h |
| diff --git a/webkit/glue/plugins/plugin_group.h b/webkit/glue/plugins/plugin_group.h |
| index a2d1aafe1d4ec4ef5512b4f40ebb2838d96b129d..8f13ae606506fd95d0c6cfcd6829dcdeb5d3386b 100644 |
| --- a/webkit/glue/plugins/plugin_group.h |
| +++ b/webkit/glue/plugins/plugin_group.h |
| @@ -21,23 +21,52 @@ class Version; |
| struct WebPluginInfo; |
| namespace NPAPI { |
| - class PluginList; |
| +class PluginList; |
| }; |
| namespace plugin_test_internal { |
| class PluginExceptionsTableModelTest; |
| +class PluginGroupTest; |
| +class TableModelArrayControllerTest; |
| } |
| +// Hard-coded version ranges for plugin groups. |
| +struct VersionRangeDefinition { |
| + // Matcher for lowest version matched by this range (inclusive). May be empty |
| + // to match everything iff |version_matcher_high| is also empty. |
| + const char* version_matcher_low; |
| + // Matcher for highest version matched by this range (exclusive). May be empty |
| + // to match anything higher than |version_matcher_low|. |
| + const char* version_matcher_high; |
| + const char* min_version; // Minimum secure version. |
| +}; |
| + |
| // 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. |
| - const char* version_matcher_high; |
| - const char* min_version; // Minimum secure version. |
| + const VersionRangeDefinition* versions; // List of version ranges. |
| + const size_t num_versions; // Size of the array |versions| points to. |
| const char* update_url; // Location of latest secure version. |
| }; |
| +// Run-time structure to hold version range information. |
| +struct VersionRange { |
| + public: |
| + explicit VersionRange(VersionRangeDefinition definition); |
| + VersionRange(const VersionRange& other); |
| + VersionRange& operator=(const VersionRange& other); |
| + |
| + std::string low_str; |
| + std::string high_str; |
| + std::string min_str; |
| + scoped_ptr<Version> low; |
| + scoped_ptr<Version> high; |
| + scoped_ptr<Version> min; |
| + private: |
| + void InitFrom(const VersionRange& other); |
| +}; |
| + |
| // A PluginGroup can match a range of versions of a specific plugin (as defined |
| // by matching a substring of its name). |
| // It contains all WebPluginInfo structs (at least one) matching its definition. |
| @@ -49,8 +78,7 @@ class PluginGroup { |
| public: |
| // Used by about:plugins to disable Reader plugin when internal PDF viewer is |
| // enabled. |
| - static const char* kAdobeReader8GroupName; |
| - static const char* kAdobeReader9GroupName; |
| + static const char* kAdobeReaderGroupName; |
| PluginGroup(const PluginGroup& other); |
| @@ -116,8 +144,8 @@ class PluginGroup { |
| typedef std::map<std::string, PluginGroup*> PluginMap; |
| friend class NPAPI::PluginList; |
| - friend class PluginGroupTest; |
| - friend class TableModelArrayControllerTest; |
| + friend class plugin_test_internal::PluginGroupTest; |
| + friend class plugin_test_internal::TableModelArrayControllerTest; |
| friend class plugin_test_internal::PluginExceptionsTableModelTest; |
| // Generates the (short) identifier string for the given plugin. |
| @@ -136,11 +164,11 @@ class PluginGroup { |
| // the created PluginGroup. |
| static PluginGroup* FromWebPluginInfo(const WebPluginInfo& wpi); |
| + static bool IsPluginOutdated(const Version& plugin_version, |
|
Bernhard Bauer
2010/12/08 13:36:30
Can you add a comment explaining the semantics of
Jakob Kummerow
2010/12/09 08:58:17
Done.
|
| + const VersionRange& version_range); |
| + |
| PluginGroup(const string16& group_name, |
| const string16& name_matcher, |
| - 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& identifier); |
| @@ -161,15 +189,10 @@ class PluginGroup { |
| std::string identifier_; |
| string16 group_name_; |
| string16 name_matcher_; |
| - std::string version_range_low_str_; |
| - std::string version_range_high_str_; |
| - scoped_ptr<Version> version_range_low_; |
| - scoped_ptr<Version> version_range_high_; |
| string16 description_; |
| std::string update_url_; |
| bool enabled_; |
| - std::string min_version_str_; |
| - scoped_ptr<Version> min_version_; |
| + std::vector<VersionRange> version_ranges_; |
| scoped_ptr<Version> version_; |
| std::vector<WebPluginInfo> web_plugin_infos_; |
| std::vector<int> web_plugin_positions_; |