Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: chrome/browser/extensions/blacklist_check.cc

Issue 2693373003: PreloadCheck class for extension pre-install checks (Closed)
Patch Set: devlin Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698