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 "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, | |
Devlin
2017/03/16 01:42:44
nit: Rather than pass in the context here, maybe p
michaelpg
2017/03/17 02:34:26
I'll keep this in mind in case it becomes an issue
| |
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 | |
OLD | NEW |