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 #include "webkit/glue/plugins/plugin_group.h" | 5 #include "webkit/glue/plugins/plugin_group.h" |
6 | 6 |
7 #include "base/linked_ptr.h" | 7 #include "base/linked_ptr.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 policy_disabled_plugin_patterns_->begin()); | 36 policy_disabled_plugin_patterns_->begin()); |
37 while (pattern != policy_disabled_plugin_patterns_->end()) { | 37 while (pattern != policy_disabled_plugin_patterns_->end()) { |
38 if (MatchPattern(plugin_name, *pattern)) | 38 if (MatchPattern(plugin_name, *pattern)) |
39 return true; | 39 return true; |
40 ++pattern; | 40 ++pattern; |
41 } | 41 } |
42 | 42 |
43 return false; | 43 return false; |
44 } | 44 } |
45 | 45 |
46 /*static*/ | |
47 bool PluginGroup::IsPluginPathDisabledByPolicy(const FilePath& plugin_path) { | |
48 std::vector<WebPluginInfo> plugins; | |
49 NPAPI::PluginList::Singleton()->GetPlugins(false, &plugins); | |
50 for (std::vector<WebPluginInfo>::const_iterator it = plugins.begin(); | |
51 it != plugins.end(); | |
52 ++it) { | |
53 if (FilePath::CompareEqualIgnoreCase(it->path.value(), | |
54 plugin_path.value()) && IsPluginNameDisabledByPolicy(it->name)) { | |
55 return true; | |
56 } | |
57 } | |
58 return false; | |
59 } | |
60 | |
61 VersionRange::VersionRange(VersionRangeDefinition definition) | 46 VersionRange::VersionRange(VersionRangeDefinition definition) |
62 : low_str(definition.version_matcher_low), | 47 : low_str(definition.version_matcher_low), |
63 high_str(definition.version_matcher_high), | 48 high_str(definition.version_matcher_high), |
64 min_str(definition.min_version) { | 49 min_str(definition.min_version) { |
65 if (!low_str.empty()) | 50 if (!low_str.empty()) |
66 low.reset(Version::GetVersionFromString(low_str)); | 51 low.reset(Version::GetVersionFromString(low_str)); |
67 if (!high_str.empty()) | 52 if (!high_str.empty()) |
68 high.reset(Version::GetVersionFromString(high_str)); | 53 high.reset(Version::GetVersionFromString(high_str)); |
69 if (!min_str.empty()) | 54 if (!min_str.empty()) |
70 min.reset(Version::GetVersionFromString(min_str)); | 55 min.reset(Version::GetVersionFromString(min_str)); |
(...skipping 25 matching lines...) Expand all Loading... | |
96 const std::string& identifier) | 81 const std::string& identifier) |
97 : identifier_(identifier), | 82 : identifier_(identifier), |
98 group_name_(group_name), | 83 group_name_(group_name), |
99 name_matcher_(name_matcher), | 84 name_matcher_(name_matcher), |
100 update_url_(update_url), | 85 update_url_(update_url), |
101 enabled_(false), | 86 enabled_(false), |
102 version_(Version::GetVersionFromString("0")) { | 87 version_(Version::GetVersionFromString("0")) { |
103 } | 88 } |
104 | 89 |
105 void PluginGroup::InitFrom(const PluginGroup& other) { | 90 void PluginGroup::InitFrom(const PluginGroup& other) { |
91 enabled_ = false; | |
106 identifier_ = other.identifier_; | 92 identifier_ = other.identifier_; |
107 group_name_ = other.group_name_; | 93 group_name_ = other.group_name_; |
108 name_matcher_ = other.name_matcher_; | 94 name_matcher_ = other.name_matcher_; |
109 description_ = other.description_; | |
110 update_url_ = other.update_url_; | 95 update_url_ = other.update_url_; |
111 enabled_ = other.enabled_; | |
112 for (size_t i = 0; i < other.version_ranges_.size(); ++i) | 96 for (size_t i = 0; i < other.version_ranges_.size(); ++i) |
113 version_ranges_.push_back(other.version_ranges_[i]); | 97 version_ranges_.push_back(other.version_ranges_[i]); |
114 DCHECK_EQ(other.web_plugin_infos_.size(), other.web_plugin_positions_.size()); | 98 std::vector<WebPluginInfo>::const_iterator it = |
115 for (size_t i = 0; i < other.web_plugin_infos_.size(); ++i) | 99 other.web_plugin_infos_.begin(); |
116 AddPlugin(other.web_plugin_infos_[i], other.web_plugin_positions_[i]); | 100 for (; it != other.web_plugin_infos_.end(); ++it) |
101 AddPlugin(*it, it->priority); | |
117 if (!version_.get()) | 102 if (!version_.get()) |
118 version_.reset(Version::GetVersionFromString("0")); | 103 version_.reset(Version::GetVersionFromString("0")); |
104 enabled_ = other.enabled_; | |
119 } | 105 } |
120 | 106 |
121 PluginGroup::PluginGroup(const PluginGroup& other) { | 107 PluginGroup::PluginGroup(const PluginGroup& other) { |
122 InitFrom(other); | 108 InitFrom(other); |
123 } | 109 } |
124 | 110 |
125 PluginGroup& PluginGroup::operator=(const PluginGroup& other) { | 111 PluginGroup& PluginGroup::operator=(const PluginGroup& other) { |
126 version_ranges_.clear(); | 112 version_ranges_.clear(); |
127 InitFrom(other); | 113 InitFrom(other); |
128 return *this; | 114 return *this; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 #endif | 146 #endif |
161 } | 147 } |
162 | 148 |
163 /*static*/ | 149 /*static*/ |
164 PluginGroup* PluginGroup::FromWebPluginInfo(const WebPluginInfo& wpi) { | 150 PluginGroup* PluginGroup::FromWebPluginInfo(const WebPluginInfo& wpi) { |
165 // Create a matcher from the name of this plugin. | 151 // Create a matcher from the name of this plugin. |
166 return new PluginGroup(wpi.name, wpi.name, std::string(), | 152 return new PluginGroup(wpi.name, wpi.name, std::string(), |
167 GetIdentifier(wpi)); | 153 GetIdentifier(wpi)); |
168 } | 154 } |
169 | 155 |
156 /*static*/ | |
157 PluginGroup* PluginGroup::CreateEmptyGroup(const string16& name) { | |
158 // Create a matcher from the name of this plugin. | |
159 return new PluginGroup(name, name, std::string(), std::string()); | |
160 } | |
161 | |
170 bool PluginGroup::Match(const WebPluginInfo& plugin) const { | 162 bool PluginGroup::Match(const WebPluginInfo& plugin) const { |
171 if (name_matcher_.empty()) { | 163 if (name_matcher_.empty()) { |
172 return false; | 164 return false; |
173 } | 165 } |
174 | 166 |
175 // Look for the name matcher anywhere in the plugin name. | 167 // Look for the name matcher anywhere in the plugin name. |
176 if (plugin.name.find(name_matcher_) == string16::npos) { | 168 if (plugin.name.find(name_matcher_) == string16::npos) { |
177 return false; | 169 return false; |
178 } | 170 } |
179 | 171 |
(...skipping 27 matching lines...) Expand all Loading... | |
207 RemoveChars(version, L") ", &version); | 199 RemoveChars(version, L") ", &version); |
208 std::replace(version.begin(), version.end(), 'r', '.'); | 200 std::replace(version.begin(), version.end(), 'r', '.'); |
209 std::replace(version.begin(), version.end(), ',', '.'); | 201 std::replace(version.begin(), version.end(), ',', '.'); |
210 std::replace(version.begin(), version.end(), '(', '.'); | 202 std::replace(version.begin(), version.end(), '(', '.'); |
211 | 203 |
212 return Version::GetVersionFromString(version); | 204 return Version::GetVersionFromString(version); |
213 } | 205 } |
214 | 206 |
215 void PluginGroup::UpdateActivePlugin(const WebPluginInfo& plugin) { | 207 void PluginGroup::UpdateActivePlugin(const WebPluginInfo& plugin) { |
216 // A group is enabled if any of the files are enabled. | 208 // A group is enabled if any of the files are enabled. |
217 if (plugin.enabled) { | 209 if (plugin.IsEnabled()) { |
218 if (!enabled_) { | 210 if (!enabled_) { |
219 // If this is the first enabled plugin, use its description. | 211 // If this is the first enabled plugin, use its description. |
220 enabled_ = true; | 212 enabled_ = true; |
221 UpdateDescriptionAndVersion(plugin); | 213 UpdateDescriptionAndVersion(plugin); |
222 } | 214 } |
223 } else { | 215 } else { |
224 // If this is the first plugin and it's disabled, | 216 // If this is the first plugin and it's disabled, |
225 // use its description for now. | 217 // use its description for now. |
226 if (description_.empty()) | 218 if (description_.empty()) |
227 UpdateDescriptionAndVersion(plugin); | 219 UpdateDescriptionAndVersion(plugin); |
228 } | 220 } |
229 } | 221 } |
230 | 222 |
231 void PluginGroup::UpdateDescriptionAndVersion(const WebPluginInfo& plugin) { | 223 void PluginGroup::UpdateDescriptionAndVersion(const WebPluginInfo& plugin) { |
232 description_ = plugin.desc; | 224 description_ = plugin.desc; |
233 if (Version* new_version = CreateVersionFromString(plugin.version)) | 225 if (Version* new_version = CreateVersionFromString(plugin.version)) |
234 version_.reset(new_version); | 226 version_.reset(new_version); |
235 else | 227 else |
236 version_.reset(Version::GetVersionFromString("0")); | 228 version_.reset(Version::GetVersionFromString("0")); |
237 } | 229 } |
238 | 230 |
239 void PluginGroup::AddPlugin(const WebPluginInfo& plugin, int position) { | 231 bool PluginGroup::AddPlugin(const WebPluginInfo& plugin, int priority) { |
240 // Check if this group already contains this plugin. | 232 // Check if this group already contains this plugin. |
241 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | 233 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { |
242 if (web_plugin_infos_[i].name == plugin.name && | 234 if (web_plugin_infos_[i].name == plugin.name && |
243 web_plugin_infos_[i].version == plugin.version && | 235 (!web_plugin_infos_[i].HasVersion() || |
236 web_plugin_infos_[i].version == plugin.version) && | |
244 FilePath::CompareEqualIgnoreCase(web_plugin_infos_[i].path.value(), | 237 FilePath::CompareEqualIgnoreCase(web_plugin_infos_[i].path.value(), |
245 plugin.path.value())) { | 238 plugin.path.value())) { |
246 return; | 239 // If no version present or priority is set to 0 then just update this |
240 // one. This was a placeholder put here by a disabled/removed plugin. | |
241 if (!web_plugin_infos_[i].HasVersion() || | |
242 web_plugin_infos_[i].priority == 0) { | |
243 // Preserve enabled flag and reason. | |
244 bool enabled = web_plugin_infos_[i].enabled; | |
245 int reason = web_plugin_infos_[i].reason; | |
246 web_plugin_infos_[i] = plugin; | |
247 web_plugin_infos_[i].priority = priority; | |
248 web_plugin_infos_[i].reason = reason; | |
249 web_plugin_infos_[i].enabled = enabled; | |
250 return true; | |
251 } | |
252 return false; | |
247 } | 253 } |
248 } | 254 } |
249 web_plugin_infos_.push_back(plugin); | 255 web_plugin_infos_.push_back(plugin); |
250 // The position of this plugin relative to the global list of plugins. | 256 // The position of this plugin relative to the global list of plugins. |
251 web_plugin_positions_.push_back(position); | 257 web_plugin_infos_.back().priority = priority; |
252 UpdateActivePlugin(plugin); | 258 UpdateActivePlugin(web_plugin_infos_.back()); |
259 return true; | |
260 } | |
261 | |
262 bool PluginGroup::EnablePlugin(const FilePath& filename) { | |
263 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | |
264 if (web_plugin_infos_[i].path == filename) { | |
265 bool did_enable = web_plugin_infos_[i].Enable(WebPluginInfo::USER); | |
266 RefreshEnabledState(); | |
267 return did_enable; | |
268 } | |
269 } | |
270 return false; | |
271 } | |
272 | |
273 bool PluginGroup::DisablePlugin(const FilePath& filename) { | |
274 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | |
275 if (web_plugin_infos_[i].path == filename) { | |
276 bool did_disable = web_plugin_infos_[i].Disable( | |
277 IsPluginNameDisabledByPolicy(web_plugin_infos_[i].name) ? | |
278 WebPluginInfo::MANAGED : WebPluginInfo::USER); | |
279 RefreshEnabledState(); | |
280 return did_disable; | |
281 } | |
282 } | |
283 return false; | |
253 } | 284 } |
254 | 285 |
255 string16 PluginGroup::GetGroupName() const { | 286 string16 PluginGroup::GetGroupName() const { |
256 if (!group_name_.empty()) | 287 if (!group_name_.empty()) |
257 return group_name_; | 288 return group_name_; |
258 DCHECK_EQ(1u, web_plugin_infos_.size()); | 289 DCHECK_EQ(1u, web_plugin_infos_.size()); |
259 FilePath::StringType path = | 290 FilePath::StringType path = |
260 web_plugin_infos_[0].path.BaseName().RemoveExtension().value(); | 291 web_plugin_infos_.front().path.BaseName().RemoveExtension().value(); |
261 #if defined(OS_POSIX) | 292 #if defined(OS_POSIX) |
262 return UTF8ToUTF16(path); | 293 return UTF8ToUTF16(path); |
263 #elif defined(OS_WIN) | 294 #elif defined(OS_WIN) |
264 return WideToUTF16(path); | 295 return WideToUTF16(path); |
265 #endif | 296 #endif |
266 } | 297 } |
267 | 298 |
299 const std::vector<WebPluginInfo>& PluginGroup::GetPlugins() const { | |
300 return web_plugin_infos_; | |
301 } | |
302 | |
303 bool PluginGroup::ContainsPlugin(const FilePath& path) const { | |
304 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | |
305 if (web_plugin_infos_[i].path == path) | |
306 return true; | |
307 } | |
308 return false; | |
309 } | |
310 | |
311 | |
268 DictionaryValue* PluginGroup::GetSummary() const { | 312 DictionaryValue* PluginGroup::GetSummary() const { |
269 DictionaryValue* result = new DictionaryValue(); | 313 DictionaryValue* result = new DictionaryValue(); |
270 result->SetString("name", GetGroupName()); | 314 result->SetString("name", GetGroupName()); |
271 result->SetBoolean("enabled", enabled_); | 315 result->SetBoolean("enabled", enabled_); |
272 return result; | 316 return result; |
273 } | 317 } |
274 | 318 |
275 DictionaryValue* PluginGroup::GetDataForUI() const { | 319 DictionaryValue* PluginGroup::GetDataForUI() const { |
276 string16 name = GetGroupName(); | 320 string16 name = GetGroupName(); |
277 DictionaryValue* result = new DictionaryValue(); | 321 DictionaryValue* result = new DictionaryValue(); |
278 result->SetString("name", name); | 322 result->SetString("name", name); |
279 result->SetString("description", description_); | 323 result->SetString("description", description_); |
280 result->SetString("version", version_->GetString()); | 324 result->SetString("version", version_->GetString()); |
281 result->SetString("update_url", update_url_); | 325 result->SetString("update_url", update_url_); |
282 result->SetBoolean("critical", IsVulnerable()); | 326 result->SetBoolean("critical", IsVulnerable()); |
283 | 327 |
284 bool group_disabled_by_policy = IsPluginNameDisabledByPolicy(name); | 328 bool group_disabled_by_policy = IsPluginNameDisabledByPolicy(name); |
285 ListValue* plugin_files = new ListValue(); | 329 ListValue* plugin_files = new ListValue(); |
286 bool all_plugins_disabled_by_policy = true; | 330 bool all_plugins_disabled_by_policy = true; |
287 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | 331 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { |
288 const WebPluginInfo& web_plugin = web_plugin_infos_[i]; | 332 int priority = web_plugin_infos_[i].priority; |
289 int priority = web_plugin_positions_[i]; | |
290 DictionaryValue* plugin_file = new DictionaryValue(); | 333 DictionaryValue* plugin_file = new DictionaryValue(); |
291 plugin_file->SetString("name", web_plugin.name); | 334 plugin_file->SetString("name", web_plugin_infos_[i].name); |
292 plugin_file->SetString("description", web_plugin.desc); | 335 plugin_file->SetString("description", web_plugin_infos_[i].desc); |
293 plugin_file->SetString("path", web_plugin.path.value()); | 336 plugin_file->SetString("path", web_plugin_infos_[i].path.value()); |
294 plugin_file->SetString("version", web_plugin.version); | 337 plugin_file->SetString("version", web_plugin_infos_[i].version); |
295 bool plugin_disabled_by_policy = group_disabled_by_policy || | 338 bool plugin_disabled_by_policy = group_disabled_by_policy || |
296 IsPluginNameDisabledByPolicy(web_plugin.name); | 339 web_plugin_infos_[i].IsManaged(web_plugin_infos_[i].reason); |
297 if (plugin_disabled_by_policy) { | 340 if (plugin_disabled_by_policy) { |
298 plugin_file->SetString("enabledMode", "disabledByPolicy"); | 341 plugin_file->SetString("enabledMode", "disabledByPolicy"); |
299 } else { | 342 } else { |
300 all_plugins_disabled_by_policy = false; | 343 all_plugins_disabled_by_policy = false; |
301 plugin_file->SetString("enabledMode", | 344 plugin_file->SetString("enabledMode", |
302 web_plugin.enabled ? "enabled" : "disabledByUser"); | 345 web_plugin_infos_[i].IsEnabled() ? |
346 "enabled" : "disabledByUser"); | |
303 } | 347 } |
304 plugin_file->SetInteger("priority", priority); | 348 plugin_file->SetInteger("priority", priority); |
305 | 349 |
306 ListValue* mime_types = new ListValue(); | 350 ListValue* mime_types = new ListValue(); |
307 for (std::vector<WebPluginMimeType>::const_iterator type_it = | 351 for (std::vector<WebPluginMimeType>::const_iterator type_it = |
308 web_plugin.mime_types.begin(); | 352 web_plugin_infos_[i].mime_types.begin(); |
309 type_it != web_plugin.mime_types.end(); | 353 type_it != web_plugin_infos_[i].mime_types.end(); |
310 ++type_it) { | 354 ++type_it) { |
311 DictionaryValue* mime_type = new DictionaryValue(); | 355 DictionaryValue* mime_type = new DictionaryValue(); |
312 mime_type->SetString("mimeType", type_it->mime_type); | 356 mime_type->SetString("mimeType", type_it->mime_type); |
313 mime_type->SetString("description", type_it->description); | 357 mime_type->SetString("description", type_it->description); |
314 | 358 |
315 ListValue* file_extensions = new ListValue(); | 359 ListValue* file_extensions = new ListValue(); |
316 for (std::vector<std::string>::const_iterator ext_it = | 360 for (std::vector<std::string>::const_iterator ext_it = |
317 type_it->file_extensions.begin(); | 361 type_it->file_extensions.begin(); |
318 ext_it != type_it->file_extensions.end(); | 362 ext_it != type_it->file_extensions.end(); |
319 ++ext_it) { | 363 ++ext_it) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 | 406 |
363 // Returns true if the latest version of this plugin group is vulnerable. | 407 // Returns true if the latest version of this plugin group is vulnerable. |
364 bool PluginGroup::IsVulnerable() const { | 408 bool PluginGroup::IsVulnerable() const { |
365 for (size_t i = 0; i < version_ranges_.size(); ++i) { | 409 for (size_t i = 0; i < version_ranges_.size(); ++i) { |
366 if (IsPluginOutdated(*version_, version_ranges_[i])) | 410 if (IsPluginOutdated(*version_, version_ranges_[i])) |
367 return true; | 411 return true; |
368 } | 412 } |
369 return false; | 413 return false; |
370 } | 414 } |
371 | 415 |
416 bool PluginGroup::IsEmpty() const { | |
417 if(web_plugin_infos_.size() == 0) | |
418 return true; | |
419 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | |
420 if(web_plugin_infos_[i].priority != 0) | |
Bernhard Bauer
2010/12/20 22:30:28
Nit: space after if.
pastarmovj
2010/12/21 16:53:02
Done.
| |
421 return false; | |
422 } | |
423 return true; | |
424 } | |
425 | |
372 void PluginGroup::DisableOutdatedPlugins() { | 426 void PluginGroup::DisableOutdatedPlugins() { |
373 description_ = string16(); | 427 bool first_enabled = true; |
374 enabled_ = false; | |
375 | 428 |
376 for (std::vector<WebPluginInfo>::iterator it = | 429 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { |
377 web_plugin_infos_.begin(); | 430 scoped_ptr<Version> version( |
378 it != web_plugin_infos_.end(); ++it) { | 431 CreateVersionFromString(web_plugin_infos_[i].version)); |
379 scoped_ptr<Version> version(CreateVersionFromString(it->version)); | |
380 if (version.get()) { | 432 if (version.get()) { |
381 for (size_t i = 0; i < version_ranges_.size(); ++i) { | 433 bool plugin_is_outdated = false; |
382 if (IsPluginOutdated(*version, version_ranges_[i])) { | 434 for (size_t j = 0; j < version_ranges_.size(); ++j) { |
383 it->enabled = false; | 435 if (IsPluginOutdated(*version, version_ranges_[j])) { |
384 NPAPI::PluginList::Singleton()->DisablePlugin(it->path); | 436 web_plugin_infos_[i].Disable(WebPluginInfo::USER); |
437 plugin_is_outdated = true; | |
438 break; | |
385 } | 439 } |
386 } | 440 } |
441 if (!plugin_is_outdated && first_enabled) { | |
442 first_enabled = false; | |
443 UpdateDescriptionAndVersion(web_plugin_infos_[i]); | |
444 } | |
387 } | 445 } |
388 UpdateActivePlugin(*it); | |
389 } | 446 } |
390 } | 447 } |
391 | 448 |
392 void PluginGroup::Enable(bool enable) { | 449 bool PluginGroup::EnableGroup(bool enable) { |
393 bool enabled_plugin_exists = false; | 450 bool enabled_plugin_exists = false; |
394 for (std::vector<WebPluginInfo>::iterator it = | 451 bool group_disabled_by_policy = IsPluginNameDisabledByPolicy(group_name_); |
395 web_plugin_infos_.begin(); | 452 // We can't enable groups disabled by policy |
396 it != web_plugin_infos_.end(); ++it) { | 453 if (group_disabled_by_policy && enable) |
397 if (enable && !IsPluginNameDisabledByPolicy(it->name)) { | 454 return false; |
398 NPAPI::PluginList::Singleton()->EnablePlugin(it->path); | 455 |
399 it->enabled = true; | 456 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { |
457 bool policy_disabled = | |
458 IsPluginNameDisabledByPolicy(web_plugin_infos_[i].name); | |
459 if (enable && !policy_disabled) { | |
460 web_plugin_infos_[i].Enable(WebPluginInfo::USER); | |
400 enabled_plugin_exists = true; | 461 enabled_plugin_exists = true; |
401 } else { | 462 } else { |
402 it->enabled = false; | 463 web_plugin_infos_[i].Disable(policy_disabled || group_disabled_by_policy ? |
403 NPAPI::PluginList::Singleton()->DisablePlugin(it->path); | 464 WebPluginInfo::MANAGED : WebPluginInfo::USER); |
404 } | 465 } |
405 } | 466 } |
406 enabled_ = enabled_plugin_exists; | 467 enabled_ = enabled_plugin_exists; |
468 return enabled_ == enable; | |
469 } | |
470 | |
471 void PluginGroup::RefreshEnabledState() { | |
472 bool enabled_plugin_exists = false; | |
473 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | |
474 if (web_plugin_infos_[i].IsEnabled()) { | |
475 enabled_plugin_exists = true; | |
476 break; | |
477 } | |
478 } | |
479 enabled_ = enabled_plugin_exists; | |
407 } | 480 } |
OLD | NEW |