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