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

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

Issue 12211029: Sanity tweaks to the extension blacklist: check all extensions at once on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mpcomplete Created 7 years, 10 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
« no previous file with comments | « chrome/browser/extensions/blacklist.h ('k') | chrome/browser/extensions/crx_installer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/blacklist.h" 5 #include "chrome/browser/extensions/blacklist.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 // Constructing the SafeBrowsingClientImpl begins the process of asking 175 // Constructing the SafeBrowsingClientImpl begins the process of asking
176 // safebrowsing for the blacklisted extensions. 176 // safebrowsing for the blacklisted extensions.
177 new SafeBrowsingClientImpl( 177 new SafeBrowsingClientImpl(
178 ids, 178 ids,
179 base::Bind(&Blacklist::OnSafeBrowsingResponse, AsWeakPtr(), 179 base::Bind(&Blacklist::OnSafeBrowsingResponse, AsWeakPtr(),
180 pref_blacklisted_ids, 180 pref_blacklisted_ids,
181 callback)); 181 callback));
182 } 182 }
183 183
184 namespace {
185 void IsNotEmpty(const Blacklist::IsBlacklistedCallback& callback,
186 const std::set<std::string>& set) {
187 callback.Run(set.empty());
188 }
189 } // namespace
Matt Perry 2013/02/07 02:16:33 nit: I think this might be against the style guide
not at google - send to devlin 2013/02/07 02:26:58 Done.
190
191 void Blacklist::IsBlacklisted(const std::string& extension_id,
192 const IsBlacklistedCallback& callback) {
193 std::set<std::string> check;
194 check.insert(extension_id);
195 GetBlacklistedIDs(check, base::Bind(&IsNotEmpty, callback));
196 }
197
184 void Blacklist::SetFromUpdater(const std::vector<std::string>& ids, 198 void Blacklist::SetFromUpdater(const std::vector<std::string>& ids,
185 const std::string& version) { 199 const std::string& version) {
186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
187 201
188 std::set<std::string> ids_as_set; 202 std::set<std::string> ids_as_set;
189 for (std::vector<std::string>::const_iterator it = ids.begin(); 203 for (std::vector<std::string>::const_iterator it = ids.begin();
190 it != ids.end(); ++it) { 204 it != ids.end(); ++it) {
191 if (Extension::IdIsValid(*it)) 205 if (Extension::IdIsValid(*it))
192 ids_as_set.insert(*it); 206 ids_as_set.insert(*it);
193 else 207 else
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 271 }
258 272
259 void Blacklist::Observe(int type, 273 void Blacklist::Observe(int type,
260 const content::NotificationSource& source, 274 const content::NotificationSource& source,
261 const content::NotificationDetails& details) { 275 const content::NotificationDetails& details) {
262 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); 276 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type);
263 FOR_EACH_OBSERVER(Observer, observers_, OnBlacklistUpdated()); 277 FOR_EACH_OBSERVER(Observer, observers_, OnBlacklistUpdated());
264 } 278 }
265 279
266 } // namespace extensions 280 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/blacklist.h ('k') | chrome/browser/extensions/crx_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698