OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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/blacklist_check.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "chrome/browser/extensions/blacklist.h" |
| 9 |
| 10 namespace extensions { |
| 11 |
| 12 BlacklistCheck::BlacklistCheck(Blacklist* blacklist, |
| 13 scoped_refptr<const Extension> extension) |
| 14 : PreloadCheck(extension), blacklist_(blacklist), weak_ptr_factory_(this) {} |
| 15 |
| 16 BlacklistCheck::~BlacklistCheck() {} |
| 17 |
| 18 void BlacklistCheck::Start(ResultCallback callback) { |
| 19 callback_ = std::move(callback); |
| 20 |
| 21 blacklist_->IsBlacklisted( |
| 22 extension()->id(), |
| 23 base::Bind(&BlacklistCheck::OnBlacklistedStateRetrieved, |
| 24 weak_ptr_factory_.GetWeakPtr())); |
| 25 } |
| 26 |
| 27 void BlacklistCheck::OnBlacklistedStateRetrieved( |
| 28 BlacklistState blacklist_state) { |
| 29 Errors errors; |
| 30 if (blacklist_state == BlacklistState::BLACKLISTED_MALWARE) |
| 31 errors.insert(PreloadCheck::BLACKLISTED_ID); |
| 32 else if (blacklist_state == BlacklistState::BLACKLISTED_UNKNOWN) |
| 33 errors.insert(PreloadCheck::BLACKLISTED_UNKNOWN); |
| 34 std::move(callback_).Run(errors); |
| 35 } |
| 36 |
| 37 } // namespace extensions |
OLD | NEW |