OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 scoped_refptr<PermissionSet> granted_permissions = | 1665 scoped_refptr<PermissionSet> granted_permissions = |
1666 extension_prefs_->GetGrantedPermissions(extension->id()); | 1666 extension_prefs_->GetGrantedPermissions(extension->id()); |
1667 CHECK(granted_permissions.get()); | 1667 CHECK(granted_permissions.get()); |
1668 | 1668 |
1669 // Here, we check if an extension's privileges have increased in a manner | 1669 // Here, we check if an extension's privileges have increased in a manner |
1670 // that requires the user's approval. This could occur because the browser | 1670 // that requires the user's approval. This could occur because the browser |
1671 // upgraded and recognized additional privileges, or an extension upgrades | 1671 // upgraded and recognized additional privileges, or an extension upgrades |
1672 // to a version that requires additional privileges. | 1672 // to a version that requires additional privileges. |
1673 is_privilege_increase = | 1673 is_privilege_increase = |
1674 extensions::PermissionMessageProvider::Get()->IsPrivilegeIncrease( | 1674 extensions::PermissionMessageProvider::Get()->IsPrivilegeIncrease( |
1675 granted_permissions, | 1675 granted_permissions, |
1676 extension->GetActivePermissions().get(), | 1676 extension->permissions_data()->active_permissions().get(), |
1677 extension->GetType()); | 1677 extension->GetType()); |
1678 } | 1678 } |
1679 | 1679 |
1680 if (is_extension_installed) { | 1680 if (is_extension_installed) { |
1681 // If the extension was already disabled, suppress any alerts for becoming | 1681 // If the extension was already disabled, suppress any alerts for becoming |
1682 // disabled on permissions increase. | 1682 // disabled on permissions increase. |
1683 bool previously_disabled = | 1683 bool previously_disabled = |
1684 extension_prefs_->IsExtensionDisabled(extension->id()); | 1684 extension_prefs_->IsExtensionDisabled(extension->id()); |
1685 // Legacy disabled extensions do not have a disable reason. Infer that if | 1685 // Legacy disabled extensions do not have a disable reason. Infer that if |
1686 // there was no permission increase, it was likely disabled by the user. | 1686 // there was no permission increase, it was likely disabled by the user. |
1687 if (previously_disabled && disable_reasons == Extension::DISABLE_NONE && | 1687 if (previously_disabled && disable_reasons == Extension::DISABLE_NONE && |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 } | 2549 } |
2550 | 2550 |
2551 void ExtensionService::OnProfileDestructionStarted() { | 2551 void ExtensionService::OnProfileDestructionStarted() { |
2552 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2552 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2553 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2553 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2554 it != ids_to_unload.end(); | 2554 it != ids_to_unload.end(); |
2555 ++it) { | 2555 ++it) { |
2556 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2556 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2557 } | 2557 } |
2558 } | 2558 } |
OLD | NEW |