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/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,
| |
10 | |
11 namespace extensions { | |
12 | |
13 BlacklistCheck::BlacklistCheck(Blacklist* blacklist, 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(extension()->id(), | |
22 base::Bind(&BlacklistCheck::OnGetIsBlacklisted, | |
23 weak_ptr_factory_.GetWeakPtr())); | |
24 } | |
25 | |
26 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.
| |
27 Errors errors; | |
28 if (blacklist_state == BlacklistState::BLACKLISTED_MALWARE) | |
29 errors.insert(PreloadCheck::BLACKLISTED_ID); | |
30 else if (blacklist_state == BlacklistState::BLACKLISTED_UNKNOWN) | |
31 errors.insert(PreloadCheck::BLACKLISTED_UNKNOWN); | |
32 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.
| |
33 } | |
34 | |
35 } // namespace extensions | |
OLD | NEW |