Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |