Chromium Code Reviews| Index: chrome/browser/extensions/blacklist_check.cc |
| diff --git a/chrome/browser/extensions/blacklist_check.cc b/chrome/browser/extensions/blacklist_check.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a6c55ea51c7061131b957b70dc20d76f779025c3 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/blacklist_check.cc |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/extensions/blacklist_check.h" |
| + |
| +#include "base/bind.h" |
| +#include "chrome/browser/extensions/blacklist.h" |
| +#include "extensions/common/constants.h" |
|
Devlin
2017/03/08 03:01:44
Needed?
michaelpg
2017/03/09 01:53:29
Removed. (Originally had the error codes in there,
|
| + |
| +namespace extensions { |
| + |
| +BlacklistCheck::BlacklistCheck(Blacklist* blacklist, const Extension* extension) |
| + : PreloadCheck(extension), blacklist_(blacklist), weak_ptr_factory_(this) {} |
| + |
| +BlacklistCheck::~BlacklistCheck() {} |
| + |
| +void BlacklistCheck::Start(ResultCallback callback) { |
| + callback_ = std::move(callback); |
| + |
| + blacklist_->IsBlacklisted(extension()->id(), |
| + base::Bind(&BlacklistCheck::OnGetIsBlacklisted, |
| + weak_ptr_factory_.GetWeakPtr())); |
| +} |
| + |
| +void BlacklistCheck::OnGetIsBlacklisted(BlacklistState blacklist_state) { |
|
Devlin
2017/03/08 03:01:44
OnGetIsBlacklisted sounds strange - maybe OnRetrie
michaelpg
2017/03/09 01:53:29
Done.
|
| + Errors errors; |
| + if (blacklist_state == BlacklistState::BLACKLISTED_MALWARE) |
| + errors.insert(PreloadCheck::BLACKLISTED_ID); |
| + else if (blacklist_state == BlacklistState::BLACKLISTED_UNKNOWN) |
| + errors.insert(PreloadCheck::BLACKLISTED_UNKNOWN); |
| + std::move(callback_).Run(errors); |
|
Devlin
2017/03/08 03:01:44
clever - but std::move() is designed to leave thin
michaelpg
2017/03/09 01:53:29
Those considerations don't apply to OnceCallback.
|
| +} |
| + |
| +} // namespace extensions |