OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ | 5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ |
6 #define CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ | 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // URL to open when the user clicks on the "Problems installing?" link. | 64 // URL to open when the user clicks on the "Problems installing?" link. |
65 const GURL& help_url() const { return help_url_; } | 65 const GURL& help_url() const { return help_url_; } |
66 | 66 |
67 const std::string& language() const { return language_; } | 67 const std::string& language() const { return language_; } |
68 | 68 |
69 bool HasMimeType(const std::string& mime_type) const; | 69 bool HasMimeType(const std::string& mime_type) const; |
70 void AddMimeType(const std::string& mime_type); | 70 void AddMimeType(const std::string& mime_type); |
71 void AddMatchingMimeType(const std::string& mime_type); | 71 void AddMatchingMimeType(const std::string& mime_type); |
72 | 72 |
73 // Adds information about a plugin version. | 73 // Adds information about a plugin version. |
74 void AddVersion(const Version& version, SecurityStatus status); | 74 void AddVersion(const base::Version& version, SecurityStatus status); |
75 | 75 |
76 // Checks if |plugin| mime types match all |matching_mime_types_|. | 76 // Checks if |plugin| mime types match all |matching_mime_types_|. |
77 // If there is no |matching_mime_types_|, |group_name_matcher_| is used | 77 // If there is no |matching_mime_types_|, |group_name_matcher_| is used |
78 // for matching. | 78 // for matching. |
79 bool MatchesPlugin(const content::WebPluginInfo& plugin); | 79 bool MatchesPlugin(const content::WebPluginInfo& plugin); |
80 | 80 |
81 // If |status_str| describes a valid security status, writes it to |status| | 81 // If |status_str| describes a valid security status, writes it to |status| |
82 // and returns true, else returns false and leaves |status| unchanged. | 82 // and returns true, else returns false and leaves |status| unchanged. |
83 static bool ParseSecurityStatus(const std::string& status_str, | 83 static bool ParseSecurityStatus(const std::string& status_str, |
84 SecurityStatus* status); | 84 SecurityStatus* status); |
85 | 85 |
86 // Returns the security status for the given plugin (i.e. whether it is | 86 // Returns the security status for the given plugin (i.e. whether it is |
87 // considered out-of-date, etc.) | 87 // considered out-of-date, etc.) |
88 SecurityStatus GetSecurityStatus(const content::WebPluginInfo& plugin) const; | 88 SecurityStatus GetSecurityStatus(const content::WebPluginInfo& plugin) const; |
89 | 89 |
90 std::unique_ptr<PluginMetadata> Clone() const; | 90 std::unique_ptr<PluginMetadata> Clone() const; |
91 | 91 |
92 private: | 92 private: |
93 struct VersionComparator { | 93 struct VersionComparator { |
94 bool operator() (const Version& lhs, const Version& rhs) const; | 94 bool operator()(const base::Version& lhs, const base::Version& rhs) const; |
95 }; | 95 }; |
96 | 96 |
97 std::string identifier_; | 97 std::string identifier_; |
98 base::string16 name_; | 98 base::string16 name_; |
99 base::string16 group_name_matcher_; | 99 base::string16 group_name_matcher_; |
100 bool url_for_display_; | 100 bool url_for_display_; |
101 GURL plugin_url_; | 101 GURL plugin_url_; |
102 GURL help_url_; | 102 GURL help_url_; |
103 std::string language_; | 103 std::string language_; |
104 std::map<Version, SecurityStatus, VersionComparator> versions_; | 104 std::map<base::Version, SecurityStatus, VersionComparator> versions_; |
105 std::vector<std::string> all_mime_types_; | 105 std::vector<std::string> all_mime_types_; |
106 std::vector<std::string> matching_mime_types_; | 106 std::vector<std::string> matching_mime_types_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(PluginMetadata); | 108 DISALLOW_COPY_AND_ASSIGN(PluginMetadata); |
109 }; | 109 }; |
110 | 110 |
111 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ | 111 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ |
OLD | NEW |