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, | |
14 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 bool PolicyCheck::GetErrorMessage(base::string16* error) const { | |
30 if (!error || !error_.size()) | |
Devlin
2017/03/08 03:01:45
Why do we want to handle null string16 pointers?
michaelpg
2017/03/09 01:53:30
you're right, that seems pointless, and it's uncle
| |
31 return false; | |
32 *error = error_; | |
33 return true; | |
34 } | |
35 | |
36 } // namespace extensions | |
OLD | NEW |