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 higher |
207 // higher priority than |info.download_location|. | 207 // priority than |info.download_location|, and we aren't doing a |
| 208 // reinstall of a corrupt policy force-installed extension. |
208 Manifest::Location current = extension->location(); | 209 Manifest::Location current = extension->location(); |
209 if (current == | 210 if (!pending_extension_manager_.IsPolicyReinstallForCorruptionExpected( |
210 Manifest::GetHigherPriorityLocation(current, info.download_location)) { | 211 info.extension_id) && |
| 212 current == Manifest::GetHigherPriorityLocation( |
| 213 current, info.download_location)) { |
211 return false; | 214 return false; |
212 } | 215 } |
213 // Otherwise, overwrite the current installation. | 216 // Otherwise, overwrite the current installation. |
214 } | 217 } |
215 | 218 |
216 // Add |info.extension_id| to the set of pending extensions. If it can not | 219 // 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 | 220 // 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 | 221 // install source. In this case, signal that this extension will not be |
219 // installed by returning false. | 222 // installed by returning false. |
220 if (!pending_extension_manager()->AddFromExternalUpdateUrl( | 223 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. | 905 // extensions, and are not user controlled. |
903 if (extension && SharedModuleInfo::IsSharedModule(extension)) | 906 if (extension && SharedModuleInfo::IsSharedModule(extension)) |
904 return; | 907 return; |
905 | 908 |
906 // |extension| can be nullptr if sync disables an extension that is not | 909 // |extension| can be nullptr if sync disables an extension that is not |
907 // installed yet. | 910 // installed yet. |
908 // EXTERNAL_COMPONENT extensions are not generally modifiable by users, but | 911 // EXTERNAL_COMPONENT extensions are not generally modifiable by users, but |
909 // can be uninstalled by the browser if the user sets extension-specific | 912 // can be uninstalled by the browser if the user sets extension-specific |
910 // preferences. | 913 // preferences. |
911 if (extension && !(disable_reasons & Extension::DISABLE_RELOAD) && | 914 if (extension && !(disable_reasons & Extension::DISABLE_RELOAD) && |
| 915 !(disable_reasons & Extension::DISABLE_CORRUPTED) && |
912 !(disable_reasons & Extension::DISABLE_UPDATE_REQUIRED_BY_POLICY) && | 916 !(disable_reasons & Extension::DISABLE_UPDATE_REQUIRED_BY_POLICY) && |
913 !system_->management_policy()->UserMayModifySettings(extension, | 917 !system_->management_policy()->UserMayModifySettings(extension, |
914 nullptr) && | 918 nullptr) && |
915 extension->location() != Manifest::EXTERNAL_COMPONENT) { | 919 extension->location() != Manifest::EXTERNAL_COMPONENT) { |
916 return; | 920 return; |
917 } | 921 } |
918 | 922 |
919 extension_prefs_->SetExtensionDisabled(extension_id, disable_reasons); | 923 extension_prefs_->SetExtensionDisabled(extension_id, disable_reasons); |
920 | 924 |
921 int include_mask = | 925 int include_mask = |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2467 } | 2471 } |
2468 | 2472 |
2469 void ExtensionService::OnProfileDestructionStarted() { | 2473 void ExtensionService::OnProfileDestructionStarted() { |
2470 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2474 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2471 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2475 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2472 it != ids_to_unload.end(); | 2476 it != ids_to_unload.end(); |
2473 ++it) { | 2477 ++it) { |
2474 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2478 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2475 } | 2479 } |
2476 } | 2480 } |
OLD | NEW |