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

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

Issue 695133005: Temporarily disable extensions and sync while a profile is locked - Profiles Approach (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove BLOCKED state. Other kalman@ comments. Created 6 years, 1 month 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) 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 void ExtensionService::AddProviderForTesting( 161 void ExtensionService::AddProviderForTesting(
162 extensions::ExternalProviderInterface* test_provider) { 162 extensions::ExternalProviderInterface* test_provider) {
163 CHECK(test_provider); 163 CHECK(test_provider);
164 external_extension_providers_.push_back( 164 external_extension_providers_.push_back(
165 linked_ptr<extensions::ExternalProviderInterface>(test_provider)); 165 linked_ptr<extensions::ExternalProviderInterface>(test_provider));
166 } 166 }
167 167
168 void ExtensionService::BlacklistExtensionForTest( 168 void ExtensionService::BlacklistExtensionForTest(
169 const std::string& extension_id) { 169 const std::string& extension_id) {
170 ExtensionIdSet blocked; 170 ExtensionIdSet blacklisted;
171 ExtensionIdSet unchanged; 171 ExtensionIdSet unchanged;
172 blocked.insert(extension_id); 172 blacklisted.insert(extension_id);
173 UpdateBlockedExtensions(blocked, unchanged); 173 UpdateBlacklistedExtensions(blacklisted, unchanged);
174 } 174 }
175 175
176 bool ExtensionService::OnExternalExtensionUpdateUrlFound( 176 bool ExtensionService::OnExternalExtensionUpdateUrlFound(
177 const std::string& id, 177 const std::string& id,
178 const std::string& install_parameter, 178 const std::string& install_parameter,
179 const GURL& update_url, 179 const GURL& update_url,
180 Manifest::Location location, 180 Manifest::Location location,
181 int creation_flags, 181 int creation_flags,
182 bool mark_acknowledged) { 182 bool mark_acknowledged) {
183 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 183 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 pending_extension_manager_(profile), 263 pending_extension_manager_(profile),
264 install_directory_(install_directory), 264 install_directory_(install_directory),
265 extensions_enabled_(extensions_enabled), 265 extensions_enabled_(extensions_enabled),
266 show_extensions_prompts_(true), 266 show_extensions_prompts_(true),
267 install_updates_when_idle_(true), 267 install_updates_when_idle_(true),
268 ready_(ready), 268 ready_(ready),
269 update_once_all_providers_are_ready_(false), 269 update_once_all_providers_are_ready_(false),
270 browser_terminating_(false), 270 browser_terminating_(false),
271 installs_delayed_for_gc_(false), 271 installs_delayed_for_gc_(false),
272 is_first_run_(false), 272 is_first_run_(false),
273 block_extensions_(false),
273 shared_module_service_(new extensions::SharedModuleService(profile_)) { 274 shared_module_service_(new extensions::SharedModuleService(profile_)) {
274 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 275 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
275 276
276 // Figure out if extension installation should be enabled. 277 // Figure out if extension installation should be enabled.
277 if (extensions::ExtensionsBrowserClient::Get()->AreExtensionsDisabled( 278 if (extensions::ExtensionsBrowserClient::Get()->AreExtensionsDisabled(
278 *command_line, profile)) 279 *command_line, profile))
279 extensions_enabled_ = false; 280 extensions_enabled_ = false;
280 281
281 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, 282 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
282 content::NotificationService::AllBrowserContextsAndSources()); 283 content::NotificationService::AllBrowserContextsAndSources());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 ->GetForBrowserContext(profile()) 368 ->GetForBrowserContext(profile())
368 ->RemoveObserver(this); 369 ->RemoveObserver(this);
369 system_->management_policy()->UnregisterProvider( 370 system_->management_policy()->UnregisterProvider(
370 shared_module_policy_provider_.get()); 371 shared_module_policy_provider_.get());
371 } 372 }
372 373
373 const Extension* ExtensionService::GetExtensionById( 374 const Extension* ExtensionService::GetExtensionById(
374 const std::string& id, bool include_disabled) const { 375 const std::string& id, bool include_disabled) const {
375 int include_mask = ExtensionRegistry::ENABLED; 376 int include_mask = ExtensionRegistry::ENABLED;
376 if (include_disabled) { 377 if (include_disabled) {
377 // Include blacklisted extensions here because there are hundreds of 378 // Include blacklisted and blocked extensions here because there are
378 // callers of this function, and many might assume that this includes those 379 // hundreds of callers of this function, and many might assume that this
379 // that have been disabled due to blacklisting. 380 // includes those that have been disabled due to blacklisting or blocking.
380 include_mask |= ExtensionRegistry::DISABLED | 381 include_mask |= ExtensionRegistry::DISABLED |
381 ExtensionRegistry::BLACKLISTED; 382 ExtensionRegistry::BLACKLISTED | ExtensionRegistry::BLOCKED;
382 } 383 }
383 return registry_->GetExtensionById(id, include_mask); 384 return registry_->GetExtensionById(id, include_mask);
384 } 385 }
385 386
386 void ExtensionService::Init() { 387 void ExtensionService::Init() {
387 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 388 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
388 389
389 base::Time begin_time = base::Time::Now(); 390 base::Time begin_time = base::Time::Now();
390 391
391 DCHECK(!is_ready()); // Can't redo init. 392 DCHECK(!is_ready()); // Can't redo init.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 const std::string& transient_extension_id, 573 const std::string& transient_extension_id,
573 bool be_noisy) { 574 bool be_noisy) {
574 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 575 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
575 576
576 // If the extension is already reloading, don't reload again. 577 // If the extension is already reloading, don't reload again.
577 if (extension_prefs_->GetDisableReasons(transient_extension_id) & 578 if (extension_prefs_->GetDisableReasons(transient_extension_id) &
578 Extension::DISABLE_RELOAD) { 579 Extension::DISABLE_RELOAD) {
579 return; 580 return;
580 } 581 }
581 582
582 // Ignore attempts to reload a blacklisted extension. Sometimes this can 583 // Ignore attempts to reload a blacklisted or blocked extension. Sometimes
583 // happen in a convoluted reload sequence triggered by the termination of a 584 // this can happen in a convoluted reload sequence triggered by the
584 // blacklisted extension and a naive attempt to reload it. For an example see 585 // termination of a blacklisted or blocked extension and a naive attempt to
585 // http://crbug.com/373842. 586 // reload it. For an example see http://crbug.com/373842.
586 if (registry_->blacklisted_extensions().Contains(transient_extension_id)) 587 if (registry_->blacklisted_extensions().Contains(transient_extension_id) ||
588 registry_->blocked_extensions().Contains(transient_extension_id)) {
587 return; 589 return;
590 }
588 591
589 base::FilePath path; 592 base::FilePath path;
590 593
591 std::string extension_id = transient_extension_id; 594 std::string extension_id = transient_extension_id;
592 const Extension* transient_current_extension = 595 const Extension* transient_current_extension =
593 GetExtensionById(extension_id, false); 596 GetExtensionById(extension_id, false);
594 597
595 // Disable the extension if it's loaded. It might not be loaded if it crashed. 598 // Disable the extension if it's loaded. It might not be loaded if it crashed.
596 if (transient_current_extension) { 599 if (transient_current_extension) {
597 // If the extension has an inspector open for its background page, detach 600 // If the extension has an inspector open for its background page, detach
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 } 785 }
783 786
784 bool ExtensionService::IsExtensionEnabled( 787 bool ExtensionService::IsExtensionEnabled(
785 const std::string& extension_id) const { 788 const std::string& extension_id) const {
786 if (registry_->enabled_extensions().Contains(extension_id) || 789 if (registry_->enabled_extensions().Contains(extension_id) ||
787 registry_->terminated_extensions().Contains(extension_id)) { 790 registry_->terminated_extensions().Contains(extension_id)) {
788 return true; 791 return true;
789 } 792 }
790 793
791 if (registry_->disabled_extensions().Contains(extension_id) || 794 if (registry_->disabled_extensions().Contains(extension_id) ||
792 registry_->blacklisted_extensions().Contains(extension_id)) { 795 registry_->blacklisted_extensions().Contains(extension_id) ||
796 registry_->blocked_extensions().Contains(extension_id)) {
793 return false; 797 return false;
794 } 798 }
795 799
800 if (block_extensions_ &&
801 CanBlockExtension(GetInstalledExtension(extension_id)))
802 return false;
803
796 // If the extension hasn't been loaded yet, check the prefs for it. Assume 804 // If the extension hasn't been loaded yet, check the prefs for it. Assume
797 // enabled unless otherwise noted. 805 // enabled unless otherwise noted.
798 return !extension_prefs_->IsExtensionDisabled(extension_id) && 806 return !extension_prefs_->IsExtensionDisabled(extension_id) &&
799 !extension_prefs_->IsExtensionBlacklisted(extension_id) && 807 !extension_prefs_->IsExtensionBlacklisted(extension_id) &&
800 !extension_prefs_->IsExternalExtensionUninstalled(extension_id); 808 !extension_prefs_->IsExternalExtensionUninstalled(extension_id);
801 } 809 }
802 810
803 void ExtensionService::EnableExtension(const std::string& extension_id) { 811 void ExtensionService::EnableExtension(const std::string& extension_id) {
804 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 812 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
805 813
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 if ((*extension)->was_installed_by_default() && 921 if ((*extension)->was_installed_by_default() &&
914 extension_urls::IsWebstoreUpdateUrl( 922 extension_urls::IsWebstoreUpdateUrl(
915 extensions::ManifestURL::GetUpdateURL(extension->get()))) 923 extensions::ManifestURL::GetUpdateURL(extension->get())))
916 continue; 924 continue;
917 const std::string& id = (*extension)->id(); 925 const std::string& id = (*extension)->id();
918 if (except_ids.end() == std::find(except_ids.begin(), except_ids.end(), id)) 926 if (except_ids.end() == std::find(except_ids.begin(), except_ids.end(), id))
919 DisableExtension(id, extensions::Extension::DISABLE_USER_ACTION); 927 DisableExtension(id, extensions::Extension::DISABLE_USER_ACTION);
920 } 928 }
921 } 929 }
922 930
931 // Extensions that are not locked, components or forced by policy should be
932 // locked. Extensions are no longer considered enabled or disabled. Blacklisted
933 // extensions are now considered both blacklisted and locked.
934 void ExtensionService::BlockAllExtensions() {
935 if (block_extensions_)
936 return;
937 block_extensions_ = true;
938
939 // Blacklisted extensions are already unloaded, need not be blocked.
940 scoped_ptr<ExtensionSet> extensions =
941 registry_->GenerateInstalledExtensionsSet(ExtensionRegistry::ENABLED |
942 ExtensionRegistry::DISABLED |
943 ExtensionRegistry::TERMINATED);
944
945 for (const scoped_refptr<const Extension>& extension : *extensions) {
946 const std::string& id = extension->id();
947
948 if (!CanBlockExtension(extension.get()))
949 continue;
950
951 registry_->RemoveEnabled(id);
952 registry_->RemoveDisabled(id);
953 registry_->RemoveTerminated(id);
954
955 registry_->AddBlocked(extension.get());
956 UnloadExtension(id, extensions::UnloadedExtensionInfo::REASON_LOCK_ALL);
957 }
958 }
959
960 // All locked extensions should revert to being either enabled or disabled
961 // as appropriate.
962 void ExtensionService::UnblockAllExtensions() {
963 block_extensions_ = false;
964 scoped_ptr<ExtensionSet> to_unblock =
965 registry_->GenerateInstalledExtensionsSet(ExtensionRegistry::BLOCKED);
966
967 for (const scoped_refptr<const Extension>& extension : *to_unblock) {
968 registry_->RemoveBlocked(extension->id());
969 AddExtension(extension.get());
970 }
971 }
972
923 void ExtensionService::GrantPermissionsAndEnableExtension( 973 void ExtensionService::GrantPermissionsAndEnableExtension(
924 const Extension* extension) { 974 const Extension* extension) {
925 GrantPermissions(extension); 975 GrantPermissions(extension);
926 RecordPermissionMessagesHistogram(extension, 976 RecordPermissionMessagesHistogram(extension,
927 "Extensions.Permissions_ReEnable2"); 977 "Extensions.Permissions_ReEnable2");
928 extension_prefs_->SetDidExtensionEscalatePermissions(extension, false); 978 extension_prefs_->SetDidExtensionEscalatePermissions(extension, false);
929 EnableExtension(extension->id()); 979 EnableExtension(extension->id());
930 } 980 }
931 981
932 void ExtensionService::GrantPermissions(const Extension* extension) { 982 void ExtensionService::GrantPermissions(const Extension* extension) {
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 // new one. ReloadExtension disables the extension, which is sufficient. 1416 // new one. ReloadExtension disables the extension, which is sufficient.
1367 UnloadExtension(extension->id(), UnloadedExtensionInfo::REASON_UPDATE); 1417 UnloadExtension(extension->id(), UnloadedExtensionInfo::REASON_UPDATE);
1368 } 1418 }
1369 1419
1370 if (extension_prefs_->IsExtensionBlacklisted(extension->id())) { 1420 if (extension_prefs_->IsExtensionBlacklisted(extension->id())) {
1371 // Only prefs is checked for the blacklist. We rely on callers to check the 1421 // Only prefs is checked for the blacklist. We rely on callers to check the
1372 // blacklist before calling into here, e.g. CrxInstaller checks before 1422 // blacklist before calling into here, e.g. CrxInstaller checks before
1373 // installation then threads through the install and pending install flow 1423 // installation then threads through the install and pending install flow
1374 // of this class, and we check when loading installed extensions. 1424 // of this class, and we check when loading installed extensions.
1375 registry_->AddBlacklisted(extension); 1425 registry_->AddBlacklisted(extension);
1426 } else if (block_extensions_ && CanBlockExtension(extension)) {
1427 registry_->AddBlocked(extension);
1376 } else if (!reloading && 1428 } else if (!reloading &&
1377 extension_prefs_->IsExtensionDisabled(extension->id())) { 1429 extension_prefs_->IsExtensionDisabled(extension->id())) {
1378 registry_->AddDisabled(extension); 1430 registry_->AddDisabled(extension);
1379 if (extension_sync_service_) 1431 if (extension_sync_service_)
1380 extension_sync_service_->SyncExtensionChangeIfNeeded(*extension); 1432 extension_sync_service_->SyncExtensionChangeIfNeeded(*extension);
1381 content::NotificationService::current()->Notify( 1433 content::NotificationService::current()->Notify(
1382 extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED, 1434 extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
1383 content::Source<Profile>(profile_), 1435 content::Source<Profile>(profile_),
1384 content::Details<const Extension>(extension)); 1436 content::Details<const Extension>(extension));
1385 1437
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 if (extension->GetType() != Manifest::TYPE_HOSTED_APP && 2220 if (extension->GetType() != Manifest::TYPE_HOSTED_APP &&
2169 Manifest::IsExternalLocation(extension->location()) && 2221 Manifest::IsExternalLocation(extension->location()) &&
2170 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { 2222 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) {
2171 return false; 2223 return false;
2172 } 2224 }
2173 } 2225 }
2174 2226
2175 return true; 2227 return true;
2176 } 2228 }
2177 2229
2230 // Helper method to determine if an extension can be blocked.
2231 bool ExtensionService::CanBlockExtension(const Extension* extension) const {
2232 return extension->location() != Manifest::COMPONENT &&
2233 extension->location() != Manifest::EXTERNAL_COMPONENT &&
2234 !system_->management_policy()->MustRemainEnabled(extension, NULL);
2235 }
2236
2178 bool ExtensionService::ShouldDelayExtensionUpdate( 2237 bool ExtensionService::ShouldDelayExtensionUpdate(
2179 const std::string& extension_id, 2238 const std::string& extension_id,
2180 bool install_immediately) const { 2239 bool install_immediately) const {
2181 const char kOnUpdateAvailableEvent[] = "runtime.onUpdateAvailable"; 2240 const char kOnUpdateAvailableEvent[] = "runtime.onUpdateAvailable";
2182 2241
2183 // If delayed updates are globally disabled, or just for this extension, 2242 // If delayed updates are globally disabled, or just for this extension,
2184 // don't delay. 2243 // don't delay.
2185 if (!install_updates_when_idle_ || install_immediately) 2244 if (!install_updates_when_idle_ || install_immediately)
2186 return false; 2245 return false;
2187 2246
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 void ExtensionService::OnBlacklistUpdated() { 2288 void ExtensionService::OnBlacklistUpdated() {
2230 blacklist_->GetBlacklistedIDs( 2289 blacklist_->GetBlacklistedIDs(
2231 registry_->GenerateInstalledExtensionsSet()->GetIDs(), 2290 registry_->GenerateInstalledExtensionsSet()->GetIDs(),
2232 base::Bind(&ExtensionService::ManageBlacklist, AsWeakPtr())); 2291 base::Bind(&ExtensionService::ManageBlacklist, AsWeakPtr()));
2233 } 2292 }
2234 2293
2235 void ExtensionService::ManageBlacklist( 2294 void ExtensionService::ManageBlacklist(
2236 const extensions::Blacklist::BlacklistStateMap& state_map) { 2295 const extensions::Blacklist::BlacklistStateMap& state_map) {
2237 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2296 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2238 2297
2239 std::set<std::string> blocked; 2298 std::set<std::string> blacklisted;
2240 ExtensionIdSet greylist; 2299 ExtensionIdSet greylist;
2241 ExtensionIdSet unchanged; 2300 ExtensionIdSet unchanged;
2242 for (extensions::Blacklist::BlacklistStateMap::const_iterator it = 2301 for (extensions::Blacklist::BlacklistStateMap::const_iterator it =
2243 state_map.begin(); 2302 state_map.begin();
2244 it != state_map.end(); 2303 it != state_map.end();
2245 ++it) { 2304 ++it) {
2246 switch (it->second) { 2305 switch (it->second) {
2247 case extensions::NOT_BLACKLISTED: 2306 case extensions::NOT_BLACKLISTED:
2248 break; 2307 break;
2249 2308
2250 case extensions::BLACKLISTED_MALWARE: 2309 case extensions::BLACKLISTED_MALWARE:
2251 blocked.insert(it->first); 2310 blacklisted.insert(it->first);
2252 break; 2311 break;
2253 2312
2254 case extensions::BLACKLISTED_SECURITY_VULNERABILITY: 2313 case extensions::BLACKLISTED_SECURITY_VULNERABILITY:
2255 case extensions::BLACKLISTED_CWS_POLICY_VIOLATION: 2314 case extensions::BLACKLISTED_CWS_POLICY_VIOLATION:
2256 case extensions::BLACKLISTED_POTENTIALLY_UNWANTED: 2315 case extensions::BLACKLISTED_POTENTIALLY_UNWANTED:
2257 greylist.insert(it->first); 2316 greylist.insert(it->first);
2258 break; 2317 break;
2259 2318
2260 case extensions::BLACKLISTED_UNKNOWN: 2319 case extensions::BLACKLISTED_UNKNOWN:
2261 unchanged.insert(it->first); 2320 unchanged.insert(it->first);
2262 break; 2321 break;
2263 } 2322 }
2264 } 2323 }
2265 2324
2266 UpdateBlockedExtensions(blocked, unchanged); 2325 UpdateBlacklistedExtensions(blacklisted, unchanged);
2267 UpdateGreylistedExtensions(greylist, unchanged, state_map); 2326 UpdateGreylistedExtensions(greylist, unchanged, state_map);
2268 2327
2269 error_controller_->ShowErrorIfNeeded(); 2328 error_controller_->ShowErrorIfNeeded();
2270 } 2329 }
2271 2330
2272 namespace { 2331 namespace {
2273 void Partition(const ExtensionIdSet& before, 2332 void Partition(const ExtensionIdSet& before,
2274 const ExtensionIdSet& after, 2333 const ExtensionIdSet& after,
2275 const ExtensionIdSet& unchanged, 2334 const ExtensionIdSet& unchanged,
2276 ExtensionIdSet* no_longer, 2335 ExtensionIdSet* no_longer,
2277 ExtensionIdSet* not_yet) { 2336 ExtensionIdSet* not_yet) {
2278 *not_yet = base::STLSetDifference<ExtensionIdSet>(after, before); 2337 *not_yet = base::STLSetDifference<ExtensionIdSet>(after, before);
2279 *no_longer = base::STLSetDifference<ExtensionIdSet>(before, after); 2338 *no_longer = base::STLSetDifference<ExtensionIdSet>(before, after);
2280 *no_longer = base::STLSetDifference<ExtensionIdSet>(*no_longer, unchanged); 2339 *no_longer = base::STLSetDifference<ExtensionIdSet>(*no_longer, unchanged);
2281 } 2340 }
2282 } // namespace 2341 } // namespace
2283 2342
2284 void ExtensionService::UpdateBlockedExtensions( 2343 void ExtensionService::UpdateBlacklistedExtensions(
2285 const ExtensionIdSet& blocked, 2344 const ExtensionIdSet& blacklisted,
2286 const ExtensionIdSet& unchanged) { 2345 const ExtensionIdSet& unchanged) {
2287 ExtensionIdSet not_yet_blocked, no_longer_blocked; 2346 ExtensionIdSet not_yet_blocked, no_longer_blocked;
2288 Partition(registry_->blacklisted_extensions().GetIDs(), 2347 Partition(registry_->blacklisted_extensions().GetIDs(), blacklisted,
2289 blocked, unchanged, 2348 unchanged, &no_longer_blocked, &not_yet_blocked);
2290 &no_longer_blocked, &not_yet_blocked);
2291 2349
2292 for (ExtensionIdSet::iterator it = no_longer_blocked.begin(); 2350 for (ExtensionIdSet::iterator it = no_longer_blocked.begin();
2293 it != no_longer_blocked.end(); ++it) { 2351 it != no_longer_blocked.end(); ++it) {
2294 scoped_refptr<const Extension> extension = 2352 scoped_refptr<const Extension> extension =
2295 registry_->blacklisted_extensions().GetByID(*it); 2353 registry_->blacklisted_extensions().GetByID(*it);
2296 if (!extension.get()) { 2354 if (!extension.get()) {
2297 NOTREACHED() << "Extension " << *it << " no longer blocked, " 2355 NOTREACHED() << "Extension " << *it << " no longer blacklisted, "
2298 << "but it was never blocked."; 2356 << "but it was never blacklisted.";
2299 continue; 2357 continue;
2300 } 2358 }
2301 registry_->RemoveBlacklisted(*it); 2359 registry_->RemoveBlacklisted(*it);
2302 extension_prefs_->SetExtensionBlacklisted(extension->id(), false); 2360 extension_prefs_->SetExtensionBlacklisted(extension->id(), false);
2303 AddExtension(extension.get()); 2361 AddExtension(extension.get());
2304 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.UnblacklistInstalled", 2362 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.UnblacklistInstalled",
2305 extension->location(), 2363 extension->location(),
2306 Manifest::NUM_LOCATIONS); 2364 Manifest::NUM_LOCATIONS);
2307 } 2365 }
2308 2366
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 } 2446 }
2389 2447
2390 void ExtensionService::OnProfileDestructionStarted() { 2448 void ExtensionService::OnProfileDestructionStarted() {
2391 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2449 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2392 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2450 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2393 it != ids_to_unload.end(); 2451 it != ids_to_unload.end();
2394 ++it) { 2452 ++it) {
2395 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2453 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2396 } 2454 }
2397 } 2455 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698