Chromium Code Reviews| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 | 196 |
| 197 if (Manifest::IsExternalLocation(info.download_location)) { | 197 if (Manifest::IsExternalLocation(info.download_location)) { |
| 198 // All extensions that are not user specific can be cached. | 198 // All extensions that are not user specific can be cached. |
| 199 extensions::ExtensionsBrowserClient::Get() | 199 extensions::ExtensionsBrowserClient::Get() |
| 200 ->GetExtensionCache() | 200 ->GetExtensionCache() |
| 201 ->AllowCaching(info.extension_id); | 201 ->AllowCaching(info.extension_id); |
| 202 } | 202 } |
| 203 | 203 |
| 204 const Extension* extension = GetExtensionById(info.extension_id, true); | 204 const Extension* extension = GetExtensionById(info.extension_id, true); |
| 205 if (extension) { | 205 if (extension) { |
| 206 // Already installed. Skip this install if the current location has | 206 // Already installed. Skip this install if the current location has |
|
lazyboy
2016/09/02 19:21:53
Add comment to reflect the new checks you've added
asargent_no_longer_on_chrome
2016/09/09 03:30:44
Done.
| |
| 207 // higher priority than |info.download_location|. | 207 // higher priority than |info.download_location|. |
| 208 Manifest::Location current = extension->location(); | 208 Manifest::Location current = extension->location(); |
| 209 if (current == | 209 if (!pending_extension_manager_.IsPolicyReinstallExpected( |
| 210 Manifest::GetHigherPriorityLocation(current, info.download_location)) { | 210 info.extension_id) && |
| 211 current == Manifest::GetHigherPriorityLocation( | |
| 212 current, info.download_location)) { | |
| 211 return false; | 213 return false; |
| 212 } | 214 } |
| 213 // Otherwise, overwrite the current installation. | 215 // Otherwise, overwrite the current installation. |
| 214 } | 216 } |
| 215 | 217 |
| 216 // Add |info.extension_id| to the set of pending extensions. If it can not | 218 // Add |info.extension_id| to the set of pending extensions. If it can not |
| 217 // be added, then there is already a pending record from a higher-priority | 219 // be added, then there is already a pending record from a higher-priority |
| 218 // install source. In this case, signal that this extension will not be | 220 // install source. In this case, signal that this extension will not be |
| 219 // installed by returning false. | 221 // installed by returning false. |
| 220 if (!pending_extension_manager()->AddFromExternalUpdateUrl( | 222 if (!pending_extension_manager()->AddFromExternalUpdateUrl( |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 902 // extensions, and are not user controlled. | 904 // extensions, and are not user controlled. |
| 903 if (extension && SharedModuleInfo::IsSharedModule(extension)) | 905 if (extension && SharedModuleInfo::IsSharedModule(extension)) |
| 904 return; | 906 return; |
| 905 | 907 |
| 906 // |extension| can be nullptr if sync disables an extension that is not | 908 // |extension| can be nullptr if sync disables an extension that is not |
| 907 // installed yet. | 909 // installed yet. |
| 908 // EXTERNAL_COMPONENT extensions are not generally modifiable by users, but | 910 // EXTERNAL_COMPONENT extensions are not generally modifiable by users, but |
| 909 // can be uninstalled by the browser if the user sets extension-specific | 911 // can be uninstalled by the browser if the user sets extension-specific |
| 910 // preferences. | 912 // preferences. |
| 911 if (extension && !(disable_reasons & Extension::DISABLE_RELOAD) && | 913 if (extension && !(disable_reasons & Extension::DISABLE_RELOAD) && |
| 914 !(disable_reasons & Extension::DISABLE_CORRUPTED) && | |
| 912 !(disable_reasons & Extension::DISABLE_UPDATE_REQUIRED_BY_POLICY) && | 915 !(disable_reasons & Extension::DISABLE_UPDATE_REQUIRED_BY_POLICY) && |
| 913 !system_->management_policy()->UserMayModifySettings(extension, | 916 !system_->management_policy()->UserMayModifySettings(extension, |
| 914 nullptr) && | 917 nullptr) && |
| 915 extension->location() != Manifest::EXTERNAL_COMPONENT) { | 918 extension->location() != Manifest::EXTERNAL_COMPONENT) { |
| 916 return; | 919 return; |
| 917 } | 920 } |
| 918 | 921 |
| 919 extension_prefs_->SetExtensionDisabled(extension_id, disable_reasons); | 922 extension_prefs_->SetExtensionDisabled(extension_id, disable_reasons); |
| 920 | 923 |
| 921 int include_mask = | 924 int include_mask = |
| (...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2467 } | 2470 } |
| 2468 | 2471 |
| 2469 void ExtensionService::OnProfileDestructionStarted() { | 2472 void ExtensionService::OnProfileDestructionStarted() { |
| 2470 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2473 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2471 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2474 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2472 it != ids_to_unload.end(); | 2475 it != ids_to_unload.end(); |
| 2473 ++it) { | 2476 ++it) { |
| 2474 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2477 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2475 } | 2478 } |
| 2476 } | 2479 } |
| OLD | NEW |