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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 return; | 817 return; |
818 const Extension* extension = | 818 const Extension* extension = |
819 registry_->disabled_extensions().GetByID(extension_id); | 819 registry_->disabled_extensions().GetByID(extension_id); |
820 | 820 |
821 ManagementPolicy* policy = system_->management_policy(); | 821 ManagementPolicy* policy = system_->management_policy(); |
822 if (extension && policy->MustRemainDisabled(extension, NULL, NULL)) { | 822 if (extension && policy->MustRemainDisabled(extension, NULL, NULL)) { |
823 UMA_HISTOGRAM_COUNTS_100("Extensions.EnableDeniedByPolicy", 1); | 823 UMA_HISTOGRAM_COUNTS_100("Extensions.EnableDeniedByPolicy", 1); |
824 return; | 824 return; |
825 } | 825 } |
826 | 826 |
827 extension_prefs_->SetExtensionState(extension_id, Extension::ENABLED); | 827 if (extension && extension->manifest() && |
828 extension->manifest()->location() == Manifest::COMPONENT) { | |
829 // Component extensions need to be put into the "ENABLED_COMPONENT", | |
benwells
2014/08/12 04:17:14
Um. Hmm. ENABLED_COMPONENT feels pretty strange. D
Anand Mistry (off Chromium)
2014/08/12 05:06:42
Adding Trent since he introduced this in https://s
tapted
2014/08/12 05:39:06
Woww so long ago. That was one of my first chrome
Anand Mistry (off Chromium)
2014/08/12 07:32:10
Removed the ENABLED_COMPONENT state, but not sure
| |
830 // otherwise, other things break later on | |
831 // (*cough* ExtensionPrefs::GetInstalledExtensionInfo()) that rely on | |
832 // component extensions being in that state. | |
833 extension_prefs_->SetExtensionState(extension_id, | |
834 Extension::ENABLED_COMPONENT); | |
835 } else { | |
836 extension_prefs_->SetExtensionState(extension_id, Extension::ENABLED); | |
837 } | |
828 extension_prefs_->ClearDisableReasons(extension_id); | 838 extension_prefs_->ClearDisableReasons(extension_id); |
829 | 839 |
830 // This can happen if sync enables an extension that is not | 840 // This can happen if sync enables an extension that is not |
831 // installed yet. | 841 // installed yet. |
832 if (!extension) | 842 if (!extension) |
833 return; | 843 return; |
834 | 844 |
835 // Move it over to the enabled list. | 845 // Move it over to the enabled list. |
836 registry_->AddEnabled(make_scoped_refptr(extension)); | 846 registry_->AddEnabled(make_scoped_refptr(extension)); |
837 registry_->RemoveDisabled(extension->id()); | 847 registry_->RemoveDisabled(extension->id()); |
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2344 } | 2354 } |
2345 | 2355 |
2346 void ExtensionService::OnProfileDestructionStarted() { | 2356 void ExtensionService::OnProfileDestructionStarted() { |
2347 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2357 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2348 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2358 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2349 it != ids_to_unload.end(); | 2359 it != ids_to_unload.end(); |
2350 ++it) { | 2360 ++it) { |
2351 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2361 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2352 } | 2362 } |
2353 } | 2363 } |
OLD | NEW |