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

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

Issue 11415216: Make Blacklist::IsBlacklist asynchronous (it will need to be for safe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/test_blacklist.h"
6
7 #include <set>
8
9 #include "base/bind.h"
10 #include "base/message_loop.h"
11 #include "base/run_loop.h"
12 #include "chrome/browser/extensions/blacklist.h"
13
14 namespace extensions {
15
16 TestBlacklist::TestBlacklist(Blacklist* blacklist)
17 : blacklist_(blacklist) {
18 }
19
20 namespace {
21
22 void IsBlacklistedCallback(std::set<std::string>* out,
23 const std::set<std::string>& in) {
24 *out = in;
25 }
26
27 } // namespace
28
29 bool TestBlacklist::IsBlacklisted(const std::string& extension_id) {
30 std::set<std::string> blacklist_set;
31 blacklist_->IsBlacklisted(
32 extension_id,
33 base::Bind(&IsBlacklistedCallback, &blacklist_set));
34 base::RunLoop run_loop;
35 MessageLoop::current()->PostTask(FROM_HERE, run_loop.QuitClosure());
36 run_loop.Run();
37 return blacklist_set.count(extension_id) > 0;
38 }
39
40 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698