OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 std::string GetUpdateURL() const { return update_url_; } | 129 std::string GetUpdateURL() const { return update_url_; } |
130 | 130 |
131 // Returns true if the highest-priority plugin in this group has known | 131 // Returns true if the highest-priority plugin in this group has known |
132 // security problems. | 132 // security problems. |
133 bool IsVulnerable() const; | 133 bool IsVulnerable() const; |
134 | 134 |
135 // Disables all plugins in this group that are older than the | 135 // Disables all plugins in this group that are older than the |
136 // minimum version. | 136 // minimum version. |
137 void DisableOutdatedPlugins(); | 137 void DisableOutdatedPlugins(); |
138 | 138 |
| 139 // Parse a version string as used by a plug-in. This method is more lenient |
| 140 // in accepting weird version strings than Version::GetFromString(). |
| 141 static Version* CreateVersionFromString(const string16& version_string); |
| 142 |
139 private: | 143 private: |
140 typedef std::map<std::string, PluginGroup*> PluginMap; | 144 typedef std::map<std::string, PluginGroup*> PluginMap; |
141 | 145 |
142 friend class NPAPI::PluginList; | 146 friend class NPAPI::PluginList; |
143 friend class PluginGroupTest; | 147 friend class PluginGroupTest; |
144 friend class TableModelArrayControllerTest; | 148 friend class TableModelArrayControllerTest; |
145 friend class PluginExceptionsTableModelTest; | 149 friend class PluginExceptionsTableModelTest; |
146 | 150 |
147 // Generates the (short) identifier string for the given plugin. | 151 // Generates the (short) identifier string for the given plugin. |
148 static std::string GetIdentifier(const WebPluginInfo& wpi); | 152 static std::string GetIdentifier(const WebPluginInfo& wpi); |
(...skipping 20 matching lines...) Expand all Loading... |
169 static bool IsPluginOutdated(const Version& plugin_version, | 173 static bool IsPluginOutdated(const Version& plugin_version, |
170 const VersionRange& version_range); | 174 const VersionRange& version_range); |
171 | 175 |
172 PluginGroup(const string16& group_name, | 176 PluginGroup(const string16& group_name, |
173 const string16& name_matcher, | 177 const string16& name_matcher, |
174 const std::string& update_url, | 178 const std::string& update_url, |
175 const std::string& identifier); | 179 const std::string& identifier); |
176 | 180 |
177 void InitFrom(const PluginGroup& other); | 181 void InitFrom(const PluginGroup& other); |
178 | 182 |
179 Version* CreateVersionFromString(const string16& version_string); | |
180 | |
181 // Set the description and version for this plugin group from the | 183 // Set the description and version for this plugin group from the |
182 // given plug-in. | 184 // given plug-in. |
183 void UpdateDescriptionAndVersion(const WebPluginInfo& plugin); | 185 void UpdateDescriptionAndVersion(const WebPluginInfo& plugin); |
184 | 186 |
185 // Updates the active plugin in the group. The active plugin is the first | 187 // Updates the active plugin in the group. The active plugin is the first |
186 // enabled one, or if all plugins are disabled, simply the first one. | 188 // enabled one, or if all plugins are disabled, simply the first one. |
187 void UpdateActivePlugin(const WebPluginInfo& plugin); | 189 void UpdateActivePlugin(const WebPluginInfo& plugin); |
188 | 190 |
189 static std::set<string16>* policy_disabled_plugin_patterns_; | 191 static std::set<string16>* policy_disabled_plugin_patterns_; |
190 | 192 |
191 std::string identifier_; | 193 std::string identifier_; |
192 string16 group_name_; | 194 string16 group_name_; |
193 string16 name_matcher_; | 195 string16 name_matcher_; |
194 string16 description_; | 196 string16 description_; |
195 std::string update_url_; | 197 std::string update_url_; |
196 bool enabled_; | 198 bool enabled_; |
197 std::vector<VersionRange> version_ranges_; | 199 std::vector<VersionRange> version_ranges_; |
198 scoped_ptr<Version> version_; | 200 scoped_ptr<Version> version_; |
199 std::vector<WebPluginInfo> web_plugin_infos_; | 201 std::vector<WebPluginInfo> web_plugin_infos_; |
200 std::vector<int> web_plugin_positions_; | 202 std::vector<int> web_plugin_positions_; |
201 }; | 203 }; |
202 | 204 |
203 #endif // WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ | 205 #endif // WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ |
OLD | NEW |