| 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 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 | 1638 |
| 1639 // Extension has changed permissions significantly. Disable it. A | 1639 // Extension has changed permissions significantly. Disable it. A |
| 1640 // notification should be sent by the caller. If the extension is already | 1640 // notification should be sent by the caller. If the extension is already |
| 1641 // disabled because it was installed remotely, don't add another disable | 1641 // disabled because it was installed remotely, don't add another disable |
| 1642 // reason. | 1642 // reason. |
| 1643 if (is_privilege_increase && | 1643 if (is_privilege_increase && |
| 1644 !(disable_reasons & Extension::DISABLE_REMOTE_INSTALL)) { | 1644 !(disable_reasons & Extension::DISABLE_REMOTE_INSTALL)) { |
| 1645 disable_reasons |= Extension::DISABLE_PERMISSIONS_INCREASE; | 1645 disable_reasons |= Extension::DISABLE_PERMISSIONS_INCREASE; |
| 1646 if (!extension_prefs_->DidExtensionEscalatePermissions(extension->id())) | 1646 if (!extension_prefs_->DidExtensionEscalatePermissions(extension->id())) |
| 1647 RecordPermissionMessagesHistogram(extension, "AutoDisable"); | 1647 RecordPermissionMessagesHistogram(extension, "AutoDisable"); |
| 1648 | |
| 1649 #if defined(ENABLE_SUPERVISED_USERS) | |
| 1650 // If a custodian-installed extension is disabled for a supervised user due | |
| 1651 // to a permissions increase, send a request to the custodian if the | |
| 1652 // supervised user themselves can't re-enable the extension. | |
| 1653 if (extensions::util::IsExtensionSupervised(extension, profile_) && | |
| 1654 extensions::util::NeedCustodianApprovalForPermissionIncrease( | |
| 1655 profile_) && | |
| 1656 !ExtensionSyncService::Get(profile_)->HasPendingReenable( | |
| 1657 extension->id(), *extension->version())) { | |
| 1658 SupervisedUserService* supervised_user_service = | |
| 1659 SupervisedUserServiceFactory::GetForProfile(profile_); | |
| 1660 supervised_user_service->AddExtensionUpdateRequest(extension->id(), | |
| 1661 *extension->version()); | |
| 1662 } | |
| 1663 #endif | |
| 1664 } | 1648 } |
| 1665 if (disable_reasons != Extension::DISABLE_NONE) | 1649 if (disable_reasons != Extension::DISABLE_NONE) |
| 1666 extension_prefs_->SetExtensionDisabled(extension->id(), disable_reasons); | 1650 extension_prefs_->SetExtensionDisabled(extension->id(), disable_reasons); |
| 1667 } | 1651 } |
| 1668 | 1652 |
| 1669 void ExtensionService::UpdateActiveExtensionsInCrashReporter() { | 1653 void ExtensionService::UpdateActiveExtensionsInCrashReporter() { |
| 1670 std::set<std::string> extension_ids; | 1654 std::set<std::string> extension_ids; |
| 1671 for (const auto& extension : registry_->enabled_extensions()) { | 1655 for (const auto& extension : registry_->enabled_extensions()) { |
| 1672 if (!extension->is_theme() && extension->location() != Manifest::COMPONENT) | 1656 if (!extension->is_theme() && extension->location() != Manifest::COMPONENT) |
| 1673 extension_ids.insert(extension->id()); | 1657 extension_ids.insert(extension->id()); |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2433 } | 2417 } |
| 2434 | 2418 |
| 2435 void ExtensionService::OnProfileDestructionStarted() { | 2419 void ExtensionService::OnProfileDestructionStarted() { |
| 2436 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2420 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2437 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2421 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2438 it != ids_to_unload.end(); | 2422 it != ids_to_unload.end(); |
| 2439 ++it) { | 2423 ++it) { |
| 2440 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2424 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2441 } | 2425 } |
| 2442 } | 2426 } |
| OLD | NEW |