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 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 | 2019 |
2020 if (!is_from_sync) { | 2020 if (!is_from_sync) { |
2021 if (extension->RequiresSortOrdinal()) { | 2021 if (extension->RequiresSortOrdinal()) { |
2022 // Reset the sort ordinals of the app to ensure it is added to the default | 2022 // Reset the sort ordinals of the app to ensure it is added to the default |
2023 // position, like newly installed apps would. | 2023 // position, like newly installed apps would. |
2024 extension_prefs_->app_sorting()->ClearOrdinals(extension->id()); | 2024 extension_prefs_->app_sorting()->ClearOrdinals(extension->id()); |
2025 extension_prefs_->app_sorting()->EnsureValidOrdinals( | 2025 extension_prefs_->app_sorting()->EnsureValidOrdinals( |
2026 extension->id(), syncer::StringOrdinal()); | 2026 extension->id(), syncer::StringOrdinal()); |
2027 } | 2027 } |
2028 | 2028 |
2029 if (extension_prefs_->IsExtensionDisabled(extension->id()) && | 2029 // Cached ephemeral apps may be updated and disabled due to permissions |
2030 !extension_prefs_->IsExtensionBlacklisted(extension->id())) { | 2030 // increase. The app can be enabled as the install was user-acknowledged. |
2031 // If the extension is not blacklisted and was disabled due to permission | 2031 if (extension_prefs_->DidExtensionEscalatePermissions(extension->id())) |
2032 // increase or user action only, we can enable it because the user was | 2032 GrantPermissionsAndEnableExtension(extension); |
2033 // prompted. | |
2034 extension_prefs_->RemoveDisableReason( | |
2035 extension->id(), | |
2036 Extension::DISABLE_PERMISSIONS_INCREASE); | |
2037 extension_prefs_->RemoveDisableReason( | |
2038 extension->id(), | |
2039 Extension::DISABLE_USER_ACTION); | |
2040 if (!extension_prefs_->GetDisableReasons(extension->id())) | |
2041 EnableExtension(extension->id()); | |
2042 } | |
2043 } | 2033 } |
2044 | 2034 |
2045 // Remove the ephemeral flags from the preferences. | 2035 // Remove the ephemeral flags from the preferences. |
2046 extension_prefs_->OnEphemeralAppPromoted(extension->id()); | 2036 extension_prefs_->OnEphemeralAppPromoted(extension->id()); |
2047 | 2037 |
2048 // Fire install-related events to allow observers to handle the promotion | 2038 // Fire install-related events to allow observers to handle the promotion |
2049 // of the ephemeral app. | 2039 // of the ephemeral app. |
2050 extensions::InstalledExtensionInfo details( | 2040 extensions::InstalledExtensionInfo details( |
2051 extension, | 2041 extension, |
2052 true /* is update */, | 2042 true /* is update */, |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 } | 2535 } |
2546 | 2536 |
2547 void ExtensionService::OnProfileDestructionStarted() { | 2537 void ExtensionService::OnProfileDestructionStarted() { |
2548 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2538 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2549 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2539 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2550 it != ids_to_unload.end(); | 2540 it != ids_to_unload.end(); |
2551 ++it) { | 2541 ++it) { |
2552 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2542 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2553 } | 2543 } |
2554 } | 2544 } |
OLD | NEW |