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 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // URL to open when the user clicks on the "Problems installing?" link. | 60 // URL to open when the user clicks on the "Problems installing?" link. |
61 const GURL& help_url() const { return help_url_; } | 61 const GURL& help_url() const { return help_url_; } |
62 | 62 |
63 const std::string& language() const { return language_; } | 63 const std::string& language() const { return language_; } |
64 | 64 |
65 bool HasMimeType(const std::string& mime_type) const; | 65 bool HasMimeType(const std::string& mime_type) const; |
66 void AddMimeType(const std::string& mime_type); | 66 void AddMimeType(const std::string& mime_type); |
67 void AddMatchingMimeType(const std::string& mime_type); | 67 void AddMatchingMimeType(const std::string& mime_type); |
68 | 68 |
69 // Adds information about a plug-in version. | 69 // Adds information about a plug-in version. |
70 void AddVersion(const base::Version& version, SecurityStatus status); | 70 void AddVersion(const Version& version, SecurityStatus status); |
71 | 71 |
72 // Checks if |plugin| mime types match all |matching_mime_types_|. | 72 // Checks if |plugin| mime types match all |matching_mime_types_|. |
73 // If there is no |matching_mime_types_|, |group_name_matcher_| is used | 73 // If there is no |matching_mime_types_|, |group_name_matcher_| is used |
74 // for matching. | 74 // for matching. |
75 bool MatchesPlugin(const content::WebPluginInfo& plugin); | 75 bool MatchesPlugin(const content::WebPluginInfo& plugin); |
76 | 76 |
77 // If |status_str| describes a valid security status, writes it to |status| | 77 // If |status_str| describes a valid security status, writes it to |status| |
78 // and returns true, else returns false and leaves |status| unchanged. | 78 // and returns true, else returns false and leaves |status| unchanged. |
79 static bool ParseSecurityStatus(const std::string& status_str, | 79 static bool ParseSecurityStatus(const std::string& status_str, |
80 SecurityStatus* status); | 80 SecurityStatus* status); |
81 | 81 |
82 // Returns the security status for the given plug-in (i.e. whether it is | 82 // Returns the security status for the given plug-in (i.e. whether it is |
83 // considered out-of-date, etc.) | 83 // considered out-of-date, etc.) |
84 SecurityStatus GetSecurityStatus(const content::WebPluginInfo& plugin) const; | 84 SecurityStatus GetSecurityStatus(const content::WebPluginInfo& plugin) const; |
85 | 85 |
86 scoped_ptr<PluginMetadata> Clone() const; | 86 scoped_ptr<PluginMetadata> Clone() const; |
87 | 87 |
88 private: | 88 private: |
89 struct VersionComparator { | 89 struct VersionComparator { |
90 bool operator() (const base::Version& lhs, const base::Version& rhs) const; | 90 bool operator() (const Version& lhs, const Version& rhs) const; |
91 }; | 91 }; |
92 | 92 |
93 std::string identifier_; | 93 std::string identifier_; |
94 base::string16 name_; | 94 base::string16 name_; |
95 base::string16 group_name_matcher_; | 95 base::string16 group_name_matcher_; |
96 bool url_for_display_; | 96 bool url_for_display_; |
97 GURL plugin_url_; | 97 GURL plugin_url_; |
98 GURL help_url_; | 98 GURL help_url_; |
99 std::string language_; | 99 std::string language_; |
100 std::map<base::Version, SecurityStatus, VersionComparator> versions_; | 100 std::map<Version, SecurityStatus, VersionComparator> versions_; |
101 std::vector<std::string> all_mime_types_; | 101 std::vector<std::string> all_mime_types_; |
102 std::vector<std::string> matching_mime_types_; | 102 std::vector<std::string> matching_mime_types_; |
103 | 103 |
104 DISALLOW_COPY_AND_ASSIGN(PluginMetadata); | 104 DISALLOW_COPY_AND_ASSIGN(PluginMetadata); |
105 }; | 105 }; |
106 | 106 |
107 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ | 107 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ |
OLD | NEW |