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