Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 196753002: [Hotword] Making enabling/disabling the setting enable/disable the hotword extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: undo profile resetter unittest change, but modify behavior when disabling extensions Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 1061
1062 void ExtensionService::DisableUserExtensions( 1062 void ExtensionService::DisableUserExtensions(
1063 const std::vector<std::string>& except_ids) { 1063 const std::vector<std::string>& except_ids) {
1064 extensions::ManagementPolicy* management_policy = 1064 extensions::ManagementPolicy* management_policy =
1065 system_->management_policy(); 1065 system_->management_policy();
1066 extensions::ExtensionList to_disable; 1066 extensions::ExtensionList to_disable;
1067 1067
1068 const ExtensionSet& enabled_set = registry_->enabled_extensions(); 1068 const ExtensionSet& enabled_set = registry_->enabled_extensions();
1069 for (ExtensionSet::const_iterator extension = enabled_set.begin(); 1069 for (ExtensionSet::const_iterator extension = enabled_set.begin();
1070 extension != enabled_set.end(); ++extension) { 1070 extension != enabled_set.end(); ++extension) {
1071 if (management_policy->UserMayModifySettings(extension->get(), NULL)) 1071 if (management_policy->UserMayModifySettings(extension->get(), NULL) &&
1072 extension->get()->location() != Manifest::EXTERNAL_COMPONENT)
1072 to_disable.push_back(*extension); 1073 to_disable.push_back(*extension);
1073 } 1074 }
1074 const ExtensionSet& terminated_set = registry_->terminated_extensions(); 1075 const ExtensionSet& terminated_set = registry_->terminated_extensions();
1075 for (ExtensionSet::const_iterator extension = terminated_set.begin(); 1076 for (ExtensionSet::const_iterator extension = terminated_set.begin();
1076 extension != terminated_set.end(); ++extension) { 1077 extension != terminated_set.end(); ++extension) {
1077 if (management_policy->UserMayModifySettings(extension->get(), NULL)) 1078 if (management_policy->UserMayModifySettings(extension->get(), NULL) &&
1079 extension->get()->location() != Manifest::EXTERNAL_COMPONENT)
miket_OOO 2014/03/17 20:10:51 This is starting to look ugly. What about wrapping
rpetterson 2014/03/17 21:14:29 Because this needs to be merged, I'd rather keep t
1078 to_disable.push_back(*extension); 1080 to_disable.push_back(*extension);
1079 } 1081 }
1080 1082
1081 for (extensions::ExtensionList::const_iterator extension = to_disable.begin(); 1083 for (extensions::ExtensionList::const_iterator extension = to_disable.begin();
1082 extension != to_disable.end(); ++extension) { 1084 extension != to_disable.end(); ++extension) {
1083 if ((*extension)->was_installed_by_default() && 1085 if ((*extension)->was_installed_by_default() &&
1084 extension_urls::IsWebstoreUpdateUrl( 1086 extension_urls::IsWebstoreUpdateUrl(
1085 extensions::ManifestURL::GetUpdateURL(*extension))) 1087 extensions::ManifestURL::GetUpdateURL(*extension)))
1086 continue; 1088 continue;
1087 const std::string& id = (*extension)->id(); 1089 const std::string& id = (*extension)->id();
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after
2881 void ExtensionService::UnloadAllExtensionsInternal() { 2883 void ExtensionService::UnloadAllExtensionsInternal() {
2882 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 2884 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
2883 2885
2884 registry_->ClearAll(); 2886 registry_->ClearAll();
2885 system_->runtime_data()->ClearAll(); 2887 system_->runtime_data()->ClearAll();
2886 2888
2887 // TODO(erikkay) should there be a notification for this? We can't use 2889 // TODO(erikkay) should there be a notification for this? We can't use
2888 // EXTENSION_UNLOADED since that implies that the extension has been disabled 2890 // EXTENSION_UNLOADED since that implies that the extension has been disabled
2889 // or uninstalled. 2891 // or uninstalled.
2890 } 2892 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698