| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 | 1593 |
| 1594 // Here, we check if an extension's privileges have increased in a manner | 1594 // Here, we check if an extension's privileges have increased in a manner |
| 1595 // that requires the user's approval. This could occur because the browser | 1595 // that requires the user's approval. This could occur because the browser |
| 1596 // upgraded and recognized additional privileges, or an extension upgrades | 1596 // upgraded and recognized additional privileges, or an extension upgrades |
| 1597 // to a version that requires additional privileges. | 1597 // to a version that requires additional privileges. |
| 1598 is_privilege_increase = | 1598 is_privilege_increase = |
| 1599 extensions::PermissionMessageProvider::Get()->IsPrivilegeIncrease( | 1599 extensions::PermissionMessageProvider::Get()->IsPrivilegeIncrease( |
| 1600 *granted_permissions, | 1600 *granted_permissions, |
| 1601 extension->permissions_data()->active_permissions(), | 1601 extension->permissions_data()->active_permissions(), |
| 1602 extension->GetType()); | 1602 extension->GetType()); |
| 1603 |
| 1604 // If there was no privilege increase, the extension might still have new |
| 1605 // permissions (which either don't generate a warning message, or whose |
| 1606 // warning messages are suppressed by existing permissions). Grant the new |
| 1607 // permissions. |
| 1608 if (!is_privilege_increase) |
| 1609 GrantPermissions(extension); |
| 1603 } | 1610 } |
| 1604 | 1611 |
| 1605 if (is_extension_installed) { | 1612 if (is_extension_installed) { |
| 1606 // If the extension was already disabled, suppress any alerts for becoming | 1613 // If the extension was already disabled, suppress any alerts for becoming |
| 1607 // disabled on permissions increase. | 1614 // disabled on permissions increase. |
| 1608 bool previously_disabled = | 1615 bool previously_disabled = |
| 1609 extension_prefs_->IsExtensionDisabled(extension->id()); | 1616 extension_prefs_->IsExtensionDisabled(extension->id()); |
| 1610 // Legacy disabled extensions do not have a disable reason. Infer that it | 1617 // Legacy disabled extensions do not have a disable reason. Infer that it |
| 1611 // was likely disabled by the user. | 1618 // was likely disabled by the user. |
| 1612 if (previously_disabled && disable_reasons == Extension::DISABLE_NONE) | 1619 if (previously_disabled && disable_reasons == Extension::DISABLE_NONE) |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2426 } | 2433 } |
| 2427 | 2434 |
| 2428 void ExtensionService::OnProfileDestructionStarted() { | 2435 void ExtensionService::OnProfileDestructionStarted() { |
| 2429 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2436 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2430 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2437 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2431 it != ids_to_unload.end(); | 2438 it != ids_to_unload.end(); |
| 2432 ++it) { | 2439 ++it) { |
| 2433 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2440 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2434 } | 2441 } |
| 2435 } | 2442 } |
| OLD | NEW |