[go: nahoru, domu]

blob: 5be0020f9c126015c3f5abcb136dc43d2b773873 [file] [log] [blame]
michaelpgc0145e62017-03-18 03:00:151// 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
11namespace extensions {
12
13PolicyCheck::PolicyCheck(content::BrowserContext* context,
14 scoped_refptr<const Extension> extension)
15 : PreloadCheck(extension), context_(context) {}
16
17PolicyCheck::~PolicyCheck() {}
18
19void PolicyCheck::Start(ResultCallback callback) {
20 Errors errors;
Devlin Croninae9baf562018-11-15 22:10:0421 if (!ExtensionSystem::Get(context_)->management_policy()->UserMayInstall(
michaelpgc0145e62017-03-18 03:00:1522 extension(), &error_)) {
23 DCHECK(!error_.empty());
24 errors.insert(DISALLOWED_BY_POLICY);
25 }
26 std::move(callback).Run(errors);
27}
28
Jan Wilken Dörrie85285b02021-03-11 23:38:4729std::u16string PolicyCheck::GetErrorMessage() const {
michaelpgc0145e62017-03-18 03:00:1530 return error_;
31}
32
33} // namespace extensions