OLD | NEW |
(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 Assign(std::set<std::string>* out, const std::set<std::string>& in) { |
| 23 *out = in; |
| 24 } |
| 25 |
| 26 } // namespace |
| 27 |
| 28 bool TestBlacklist::IsBlacklisted(const std::string& extension_id) { |
| 29 std::set<std::string> id_set; |
| 30 id_set.insert(extension_id); |
| 31 std::set<std::string> blacklist_set; |
| 32 blacklist_->GetBlacklistedIDs(id_set, |
| 33 base::Bind(&Assign, &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 |
OLD | NEW |