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/plugins/npapi/plugin_group.h" | 5 #include "webkit/plugins/npapi/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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "base/version.h" | 12 #include "base/version.h" |
13 #include "webkit/plugins/npapi/plugin_list.h" | 13 #include "webkit/plugins/npapi/plugin_list.h" |
14 #include "webkit/plugins/npapi/webplugininfo.h" | 14 #include "webkit/plugins/npapi/webplugininfo.h" |
15 | 15 |
16 namespace webkit { | 16 namespace webkit { |
17 namespace npapi { | 17 namespace npapi { |
18 | 18 |
19 const char* PluginGroup::kAdobeReaderGroupName = "Adobe Reader"; | 19 const char* PluginGroup::kAdobeReaderGroupName = "Adobe Reader"; |
20 const char* PluginGroup::kAdobeReaderUpdateURL = "http://get.adobe.com/reader/"; | 20 const char* PluginGroup::kAdobeReaderUpdateURL = "http://get.adobe.com/reader/"; |
21 const char* PluginGroup::kJavaGroupName = "Java"; | |
22 const char* PluginGroup::kIcedTeaGroupName = "IcedTea"; | |
23 const char* PluginGroup::kQuickTimeGroupName = "QuickTime"; | |
24 const char* PluginGroup::kShockwaveGroupName = "Shockwave"; | |
21 | 25 |
22 /*static*/ | 26 /*static*/ |
23 std::set<string16>* PluginGroup::policy_disabled_plugin_patterns_; | 27 std::set<string16>* PluginGroup::policy_disabled_plugin_patterns_; |
24 | 28 |
25 /*static*/ | 29 /*static*/ |
26 void PluginGroup::SetPolicyDisabledPluginPatterns( | 30 void PluginGroup::SetPolicyDisabledPluginPatterns( |
27 const std::set<string16>& set) { | 31 const std::set<string16>& set) { |
28 if (!policy_disabled_plugin_patterns_) | 32 if (!policy_disabled_plugin_patterns_) |
29 policy_disabled_plugin_patterns_ = new std::set<string16>(set); | 33 policy_disabled_plugin_patterns_ = new std::set<string16>(set); |
30 else | 34 else |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 | 370 |
367 // Returns true if the latest version of this plugin group is vulnerable. | 371 // Returns true if the latest version of this plugin group is vulnerable. |
368 bool PluginGroup::IsVulnerable() const { | 372 bool PluginGroup::IsVulnerable() const { |
369 for (size_t i = 0; i < version_ranges_.size(); ++i) { | 373 for (size_t i = 0; i < version_ranges_.size(); ++i) { |
370 if (IsPluginOutdated(*version_, version_ranges_[i])) | 374 if (IsPluginOutdated(*version_, version_ranges_[i])) |
371 return true; | 375 return true; |
372 } | 376 } |
373 return false; | 377 return false; |
374 } | 378 } |
375 | 379 |
380 bool PluginGroup::RequiresAuthorization() const { | |
381 return group_name_ == ASCIIToUTF16(kJavaGroupName) || | |
Bernhard Bauer
2011/01/24 12:56:33
I think I'd prefer to reuse the rest of the Plugin
| |
382 group_name_ == ASCIIToUTF16(kIcedTeaGroupName) || | |
383 group_name_ == ASCIIToUTF16(kQuickTimeGroupName) || | |
384 group_name_ == ASCIIToUTF16(kShockwaveGroupName); | |
385 } | |
386 | |
376 void PluginGroup::DisableOutdatedPlugins() { | 387 void PluginGroup::DisableOutdatedPlugins() { |
377 description_ = string16(); | 388 description_ = string16(); |
378 enabled_ = false; | 389 enabled_ = false; |
379 | 390 |
380 for (std::vector<WebPluginInfo>::iterator it = | 391 for (std::vector<WebPluginInfo>::iterator it = |
381 web_plugin_infos_.begin(); | 392 web_plugin_infos_.begin(); |
382 it != web_plugin_infos_.end(); ++it) { | 393 it != web_plugin_infos_.end(); ++it) { |
383 scoped_ptr<Version> version(CreateVersionFromString(it->version)); | 394 scoped_ptr<Version> version(CreateVersionFromString(it->version)); |
384 if (version.get()) { | 395 if (version.get()) { |
385 for (size_t i = 0; i < version_ranges_.size(); ++i) { | 396 for (size_t i = 0; i < version_ranges_.size(); ++i) { |
(...skipping 19 matching lines...) Expand all Loading... | |
405 } else { | 416 } else { |
406 it->enabled = false; | 417 it->enabled = false; |
407 PluginList::Singleton()->DisablePlugin(it->path); | 418 PluginList::Singleton()->DisablePlugin(it->path); |
408 } | 419 } |
409 } | 420 } |
410 enabled_ = enabled_plugin_exists; | 421 enabled_ = enabled_plugin_exists; |
411 } | 422 } |
412 | 423 |
413 } // namespace npapi | 424 } // namespace npapi |
414 } // namespace webkit | 425 } // namespace webkit |
OLD | NEW |