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

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

Issue 23591050: Delete the omahaproxy-backed extension blacklist and clear its entries from the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix memory leak in blacklist test Created 7 years, 3 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 int update_frequency = kDefaultUpdateFrequencySeconds; 407 int update_frequency = kDefaultUpdateFrequencySeconds;
408 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) { 408 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) {
409 base::StringToInt(command_line->GetSwitchValueASCII( 409 base::StringToInt(command_line->GetSwitchValueASCII(
410 switches::kExtensionsUpdateFrequency), 410 switches::kExtensionsUpdateFrequency),
411 &update_frequency); 411 &update_frequency);
412 } 412 }
413 updater_.reset(new extensions::ExtensionUpdater(this, 413 updater_.reset(new extensions::ExtensionUpdater(this,
414 extension_prefs, 414 extension_prefs,
415 profile->GetPrefs(), 415 profile->GetPrefs(),
416 profile, 416 profile,
417 blacklist,
418 update_frequency)); 417 update_frequency));
419 } 418 }
420 419
421 component_loader_.reset( 420 component_loader_.reset(
422 new extensions::ComponentLoader(this, 421 new extensions::ComponentLoader(this,
423 profile->GetPrefs(), 422 profile->GetPrefs(),
424 g_browser_process->local_state())); 423 g_browser_process->local_state()));
425 424
426 if (extensions_enabled_) { 425 if (extensions_enabled_) {
427 extensions::ExternalProviderImpl::CreateExternalProviders( 426 extensions::ExternalProviderImpl::CreateExternalProviders(
(...skipping 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after
3088 } 3087 }
3089 } 3088 }
3090 3089
3091 void ExtensionService::OnNeedsToGarbageCollectIsolatedStorage() { 3090 void ExtensionService::OnNeedsToGarbageCollectIsolatedStorage() {
3092 extension_prefs_->SetNeedsStorageGarbageCollection(true); 3091 extension_prefs_->SetNeedsStorageGarbageCollection(true);
3093 } 3092 }
3094 3093
3095 void ExtensionService::OnBlacklistUpdated() { 3094 void ExtensionService::OnBlacklistUpdated() {
3096 blacklist_->GetBlacklistedIDs( 3095 blacklist_->GetBlacklistedIDs(
3097 GenerateInstalledExtensionsSet()->GetIDs(), 3096 GenerateInstalledExtensionsSet()->GetIDs(),
3098 base::Bind(&ExtensionService::ManageBlacklist, 3097 base::Bind(&ExtensionService::ManageBlacklist, AsWeakPtr()));
3099 AsWeakPtr(),
3100 blacklisted_extensions_.GetIDs()));
3101 } 3098 }
3102 3099
3103 void ExtensionService::ManageBlacklist( 3100 void ExtensionService::ManageBlacklist(const std::set<std::string>& updated) {
3104 const std::set<std::string>& old_blacklisted_ids,
3105 const std::set<std::string>& new_blacklisted_ids) {
3106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 3101 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
3107 3102
3103 std::set<std::string> before = blacklisted_extensions_.GetIDs();
3108 std::set<std::string> no_longer_blacklisted = 3104 std::set<std::string> no_longer_blacklisted =
3109 base::STLSetDifference<std::set<std::string> >(old_blacklisted_ids, 3105 base::STLSetDifference<std::set<std::string> >(before, updated);
3110 new_blacklisted_ids);
3111 std::set<std::string> not_yet_blacklisted = 3106 std::set<std::string> not_yet_blacklisted =
3112 base::STLSetDifference<std::set<std::string> >(new_blacklisted_ids, 3107 base::STLSetDifference<std::set<std::string> >(updated, before);
3113 old_blacklisted_ids);
3114 3108
3115 for (std::set<std::string>::iterator it = no_longer_blacklisted.begin(); 3109 for (std::set<std::string>::iterator it = no_longer_blacklisted.begin();
3116 it != no_longer_blacklisted.end(); ++it) { 3110 it != no_longer_blacklisted.end(); ++it) {
3117 scoped_refptr<const Extension> extension = 3111 scoped_refptr<const Extension> extension =
3118 blacklisted_extensions_.GetByID(*it); 3112 blacklisted_extensions_.GetByID(*it);
3119 DCHECK(extension.get()) << "Extension " << *it << " no longer blacklisted, " 3113 if (!extension.get()) {
3120 << "but it was never blacklisted."; 3114 NOTREACHED() << "Extension " << *it << " no longer blacklisted, "
3121 if (!extension.get()) 3115 << "but it was never blacklisted.";
3122 continue; 3116 continue;
3117 }
3123 blacklisted_extensions_.Remove(*it); 3118 blacklisted_extensions_.Remove(*it);
3119 extension_prefs_->SetExtensionBlacklisted(extension->id(), false);
3124 AddExtension(extension.get()); 3120 AddExtension(extension.get());
3125 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.UnblacklistInstalled", 3121 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.UnblacklistInstalled",
3126 extension->location(), 3122 extension->location(),
3127 Manifest::NUM_LOCATIONS); 3123 Manifest::NUM_LOCATIONS);
3128 } 3124 }
3129 3125
3130 for (std::set<std::string>::iterator it = not_yet_blacklisted.begin(); 3126 for (std::set<std::string>::iterator it = not_yet_blacklisted.begin();
3131 it != not_yet_blacklisted.end(); ++it) { 3127 it != not_yet_blacklisted.end(); ++it) {
3132 scoped_refptr<const Extension> extension = GetInstalledExtension(*it); 3128 scoped_refptr<const Extension> extension = GetInstalledExtension(*it);
3133 DCHECK(extension.get()) << "Extension " << *it << " needs to be " 3129 if (!extension.get()) {
3134 << "blacklisted, but it's not installed."; 3130 NOTREACHED() << "Extension " << *it << " needs to be "
3135 if (!extension.get()) 3131 << "blacklisted, but it's not installed.";
3136 continue; 3132 continue;
3133 }
3137 blacklisted_extensions_.Insert(extension); 3134 blacklisted_extensions_.Insert(extension);
3135 extension_prefs_->SetExtensionBlacklisted(extension->id(), true);
3138 UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST); 3136 UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST);
3139 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlacklistInstalled", 3137 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlacklistInstalled",
3140 extension->location(), Manifest::NUM_LOCATIONS); 3138 extension->location(), Manifest::NUM_LOCATIONS);
3141 } 3139 }
3142 3140
3143 IdentifyAlertableExtensions(); 3141 IdentifyAlertableExtensions();
3144 } 3142 }
3145 3143
3146 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 3144 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
3147 update_observers_.AddObserver(observer); 3145 update_observers_.AddObserver(observer);
3148 } 3146 }
3149 3147
3150 void ExtensionService::RemoveUpdateObserver( 3148 void ExtensionService::RemoveUpdateObserver(
3151 extensions::UpdateObserver* observer) { 3149 extensions::UpdateObserver* observer) {
3152 update_observers_.RemoveObserver(observer); 3150 update_observers_.RemoveObserver(observer);
3153 } 3151 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/extension_service_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698