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

Side by Side Diff: extensions/browser/policy_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
« no previous file with comments | « extensions/browser/policy_check.h ('k') | extensions/browser/policy_check_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/policy_check.h"
6
7 #include "content/public/browser/browser_context.h"
8 #include "extensions/browser/extension_system.h"
9 #include "extensions/browser/management_policy.h"
10
11 namespace extensions {
12
13 PolicyCheck::PolicyCheck(content::BrowserContext* context,
14 scoped_refptr<const Extension> extension)
15 : PreloadCheck(extension), context_(context) {}
16
17 PolicyCheck::~PolicyCheck() {}
18
19 void PolicyCheck::Start(ResultCallback callback) {
20 Errors errors;
21 if (!ExtensionSystem::Get(context_)->management_policy()->UserMayLoad(
22 extension(), &error_)) {
23 DCHECK(!error_.empty());
24 errors.insert(DISALLOWED_BY_POLICY);
25 }
26 std::move(callback).Run(errors);
27 }
28
29 base::string16 PolicyCheck::GetErrorMessage() const {
30 return error_;
31 }
32
33 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/policy_check.h ('k') | extensions/browser/policy_check_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698