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

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

Issue 10854009: Extension white and force lists (set by policy) should have priority over auto-updated Google black… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed NULL instead of false Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 if (Extension::IdIsValid(blacklist[i])) { 1119 if (Extension::IdIsValid(blacklist[i])) {
1120 blacklist_set.insert(blacklist[i]); 1120 blacklist_set.insert(blacklist[i]);
1121 } 1121 }
1122 } 1122 }
1123 extension_prefs_->UpdateBlacklist(blacklist_set); 1123 extension_prefs_->UpdateBlacklist(blacklist_set);
1124 std::vector<std::string> to_be_removed; 1124 std::vector<std::string> to_be_removed;
1125 // Loop current extensions, unload installed extensions. 1125 // Loop current extensions, unload installed extensions.
1126 for (ExtensionSet::const_iterator iter = extensions_.begin(); 1126 for (ExtensionSet::const_iterator iter = extensions_.begin();
1127 iter != extensions_.end(); ++iter) { 1127 iter != extensions_.end(); ++iter) {
1128 const Extension* extension = (*iter); 1128 const Extension* extension = (*iter);
1129 if (blacklist_set.find(extension->id()) != blacklist_set.end()) { 1129
1130 // Do not use blacklist_set as this does not take into account whitelist and
1131 // forcelist policies.
1132 if (extension_prefs_->IsExtensionBlacklisted(extension->id())) {
Mattias Nissler (ping if slow) 2012/08/08 08:08:37 should call into extensions::ManagementPolicy here
1130 to_be_removed.push_back(extension->id()); 1133 to_be_removed.push_back(extension->id());
1131 } 1134 }
1132 } 1135 }
1133 1136
1134 // UnloadExtension will change the extensions_ list. So, we should 1137 // UnloadExtension will change the extensions_ list. So, we should
1135 // call it outside the iterator loop. 1138 // call it outside the iterator loop.
1136 for (unsigned int i = 0; i < to_be_removed.size(); ++i) { 1139 for (unsigned int i = 0; i < to_be_removed.size(); ++i) {
1137 UnloadExtension(to_be_removed[i], extension_misc::UNLOAD_REASON_DISABLE); 1140 UnloadExtension(to_be_removed[i], extension_misc::UNLOAD_REASON_DISABLE);
1138 } 1141 }
1139 } 1142 }
(...skipping 21 matching lines...) Expand all
1161 extensions::ExtensionUpdater* ExtensionService::updater() { 1164 extensions::ExtensionUpdater* ExtensionService::updater() {
1162 return updater_.get(); 1165 return updater_.get();
1163 } 1166 }
1164 1167
1165 void ExtensionService::CheckAdminBlacklist() { 1168 void ExtensionService::CheckAdminBlacklist() {
1166 std::vector<std::string> to_be_removed; 1169 std::vector<std::string> to_be_removed;
1167 // Loop through extensions list, unload installed extensions. 1170 // Loop through extensions list, unload installed extensions.
1168 for (ExtensionSet::const_iterator iter = extensions_.begin(); 1171 for (ExtensionSet::const_iterator iter = extensions_.begin();
1169 iter != extensions_.end(); ++iter) { 1172 iter != extensions_.end(); ++iter) {
1170 const Extension* extension = (*iter); 1173 const Extension* extension = (*iter);
1171 if (!system_->management_policy()->UserMayLoad(extension, NULL)) { 1174
1175 // Blacklisting status may have changed in the result of policy change so
1176 // check it too.
1177 if (!system_->management_policy()->UserMayLoad(extension, NULL) ||
1178 extension_prefs_->IsExtensionBlacklisted(extension->id())) {
Mattias Nissler (ping if slow) 2012/08/08 08:08:37 same here.
1172 to_be_removed.push_back(extension->id()); 1179 to_be_removed.push_back(extension->id());
1173 } 1180 }
1174 } 1181 }
1175 1182
1176 // UnloadExtension will change the extensions_ list. So, we should 1183 // UnloadExtension will change the extensions_ list. So, we should
1177 // call it outside the iterator loop. 1184 // call it outside the iterator loop.
1178 for (unsigned int i = 0; i < to_be_removed.size(); ++i) 1185 for (unsigned int i = 0; i < to_be_removed.size(); ++i)
1179 UnloadExtension(to_be_removed[i], extension_misc::UNLOAD_REASON_DISABLE); 1186 UnloadExtension(to_be_removed[i], extension_misc::UNLOAD_REASON_DISABLE);
1180 } 1187 }
1181 1188
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 2553
2547 ExtensionService::NaClModuleInfoList::iterator 2554 ExtensionService::NaClModuleInfoList::iterator
2548 ExtensionService::FindNaClModule(const GURL& url) { 2555 ExtensionService::FindNaClModule(const GURL& url) {
2549 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2556 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2550 iter != nacl_module_list_.end(); ++iter) { 2557 iter != nacl_module_list_.end(); ++iter) {
2551 if (iter->url == url) 2558 if (iter->url == url)
2552 return iter; 2559 return iter;
2553 } 2560 }
2554 return nacl_module_list_.end(); 2561 return nacl_module_list_.end();
2555 } 2562 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698