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

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

Issue 2693373003: PreloadCheck class for extension pre-install checks (Closed)
Patch Set: don't break enable_extensions=false 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 #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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/blacklist_check.h ('k') | chrome/browser/extensions/blacklist_check_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698