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

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

Issue 22460011: [CleanUp] Use base::STLSetDifference in place of std::set_difference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing head file. Created 7 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) 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 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3118 base::Bind(&ExtensionService::ManageBlacklist, 3118 base::Bind(&ExtensionService::ManageBlacklist,
3119 AsWeakPtr(), 3119 AsWeakPtr(),
3120 blacklisted_extensions_.GetIDs())); 3120 blacklisted_extensions_.GetIDs()));
3121 } 3121 }
3122 3122
3123 void ExtensionService::ManageBlacklist( 3123 void ExtensionService::ManageBlacklist(
3124 const std::set<std::string>& old_blacklisted_ids, 3124 const std::set<std::string>& old_blacklisted_ids,
3125 const std::set<std::string>& new_blacklisted_ids) { 3125 const std::set<std::string>& new_blacklisted_ids) {
3126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 3126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
3127 3127
3128 std::set<std::string> no_longer_blacklisted; 3128 std::set<std::string> no_longer_blacklisted =
3129 std::set_difference(old_blacklisted_ids.begin(), old_blacklisted_ids.end(), 3129 base::STLSetDifference<std::set<std::string> >(old_blacklisted_ids,
3130 new_blacklisted_ids.begin(), new_blacklisted_ids.end(), 3130 new_blacklisted_ids);
3131 std::inserter(no_longer_blacklisted, 3131 std::set<std::string> not_yet_blacklisted =
3132 no_longer_blacklisted.begin())); 3132 base::STLSetDifference<std::set<std::string> >(new_blacklisted_ids,
3133 std::set<std::string> not_yet_blacklisted; 3133 old_blacklisted_ids);
3134 std::set_difference(new_blacklisted_ids.begin(), new_blacklisted_ids.end(),
3135 old_blacklisted_ids.begin(), old_blacklisted_ids.end(),
3136 std::inserter(not_yet_blacklisted,
3137 not_yet_blacklisted.begin()));
3138 3134
3139 for (std::set<std::string>::iterator it = no_longer_blacklisted.begin(); 3135 for (std::set<std::string>::iterator it = no_longer_blacklisted.begin();
3140 it != no_longer_blacklisted.end(); ++it) { 3136 it != no_longer_blacklisted.end(); ++it) {
3141 scoped_refptr<const Extension> extension = 3137 scoped_refptr<const Extension> extension =
3142 blacklisted_extensions_.GetByID(*it); 3138 blacklisted_extensions_.GetByID(*it);
3143 DCHECK(extension.get()) << "Extension " << *it << " no longer blacklisted, " 3139 DCHECK(extension.get()) << "Extension " << *it << " no longer blacklisted, "
3144 << "but it was never blacklisted."; 3140 << "but it was never blacklisted.";
3145 if (!extension.get()) 3141 if (!extension.get())
3146 continue; 3142 continue;
3147 blacklisted_extensions_.Remove(*it); 3143 blacklisted_extensions_.Remove(*it);
(...skipping 20 matching lines...) Expand all
3168 } 3164 }
3169 3165
3170 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 3166 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
3171 update_observers_.AddObserver(observer); 3167 update_observers_.AddObserver(observer);
3172 } 3168 }
3173 3169
3174 void ExtensionService::RemoveUpdateObserver( 3170 void ExtensionService::RemoveUpdateObserver(
3175 extensions::UpdateObserver* observer) { 3171 extensions::UpdateObserver* observer) {
3176 update_observers_.RemoveObserver(observer); 3172 update_observers_.RemoveObserver(observer);
3177 } 3173 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/blacklist.cc ('k') | chrome/browser/history/url_index_private_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698