OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "webkit/plugins/npapi/plugin_group.h" | 7 #include "webkit/plugins/npapi/plugin_group.h" |
8 | 8 |
9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 version_ranges_[i].requires_authorization) | 503 version_ranges_[i].requires_authorization) |
504 return true; | 504 return true; |
505 } | 505 } |
506 return false; | 506 return false; |
507 } | 507 } |
508 | 508 |
509 bool PluginGroup::IsEmpty() const { | 509 bool PluginGroup::IsEmpty() const { |
510 return web_plugin_infos_.empty(); | 510 return web_plugin_infos_.empty(); |
511 } | 511 } |
512 | 512 |
513 void PluginGroup::DisableOutdatedPlugins() { | |
514 ResetGroupState(); | |
515 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | |
516 scoped_ptr<Version> version( | |
517 CreateVersionFromString(web_plugin_infos_[i].version)); | |
518 if (version.get()) { | |
519 for (size_t j = 0; j < version_ranges_.size(); ++j) { | |
520 if (IsPluginOutdated(*version, version_ranges_[j])) { | |
521 Disable(&web_plugin_infos_[i], WebPluginInfo::USER_DISABLED); | |
522 break; | |
523 } | |
524 } | |
525 } | |
526 UpdateActivePlugin(web_plugin_infos_[i]); | |
527 } | |
528 } | |
529 | |
530 bool PluginGroup::EnableGroup(bool enable) { | 513 bool PluginGroup::EnableGroup(bool enable) { |
531 bool group_disabled_by_policy = IsPluginNameDisabledByPolicy(group_name_); | 514 bool group_disabled_by_policy = IsPluginNameDisabledByPolicy(group_name_); |
532 bool group_enabled_by_policy = IsPluginNameEnabledByPolicy(group_name_); | 515 bool group_enabled_by_policy = IsPluginNameEnabledByPolicy(group_name_); |
533 | 516 |
534 // We can't enable nor disable groups controlled by policy. | 517 // We can't enable nor disable groups controlled by policy. |
535 if ((group_disabled_by_policy && enable) || | 518 if ((group_disabled_by_policy && enable) || |
536 (group_enabled_by_policy && !enable)) | 519 (group_enabled_by_policy && !enable)) |
537 return false; | 520 return false; |
538 | 521 |
539 ResetGroupState(); | 522 ResetGroupState(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 bool PluginGroup::Disable(WebPluginInfo* plugin, int new_reason) { | 614 bool PluginGroup::Disable(WebPluginInfo* plugin, int new_reason) { |
632 DCHECK(new_reason == WebPluginInfo::USER_DISABLED || | 615 DCHECK(new_reason == WebPluginInfo::USER_DISABLED || |
633 new_reason == WebPluginInfo::POLICY_DISABLED || | 616 new_reason == WebPluginInfo::POLICY_DISABLED || |
634 new_reason == WebPluginInfo::USER_DISABLED_POLICY_DISABLED || | 617 new_reason == WebPluginInfo::USER_DISABLED_POLICY_DISABLED || |
635 new_reason == WebPluginInfo::POLICY_UNMANAGED); | 618 new_reason == WebPluginInfo::POLICY_UNMANAGED); |
636 return SetPluginState(plugin, new_reason, IsPluginEnabled(*plugin)); | 619 return SetPluginState(plugin, new_reason, IsPluginEnabled(*plugin)); |
637 } | 620 } |
638 | 621 |
639 } // namespace npapi | 622 } // namespace npapi |
640 } // namespace webkit | 623 } // namespace webkit |
OLD | NEW |