Add a webstorePrivate API to show a permission prompt for delegated bundle installs
[chromium-blink-merge.git] / chrome / browser / extensions / external_policy_loader.h
blob81e74f4b8021db1eb5b71923d08f405bb0bf501a
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/extensions/extension_management.h"
12 #include "chrome/browser/extensions/external_loader.h"
14 namespace base {
15 class DictionaryValue;
18 namespace extensions {
20 // A specialization of the ExternalProvider that uses extension management
21 // policies to look up which external extensions are registered.
22 class ExternalPolicyLoader : public ExternalLoader,
23 public ExtensionManagement::Observer {
24 public:
25 // Indicates the policies for installed extensions from this class, according
26 // to management polices.
27 enum InstallationType {
28 // Installed extensions are not allowed to be disabled or removed.
29 FORCED,
30 // Installed extensions are allowed to be disabled but not removed.
31 RECOMMENDED
34 ExternalPolicyLoader(ExtensionManagement* settings, InstallationType type);
36 // ExtensionManagement::Observer implementation
37 void OnExtensionManagementSettingsChanged() override;
39 // Adds an extension to be updated to the pref dictionary.
40 static void AddExtension(base::DictionaryValue* dict,
41 const std::string& extension_id,
42 const std::string& update_url);
44 protected:
45 void StartLoading() override;
47 private:
48 friend class base::RefCountedThreadSafe<ExternalLoader>;
50 ~ExternalPolicyLoader() override;
52 ExtensionManagement* settings_;
53 InstallationType type_;
55 DISALLOW_COPY_AND_ASSIGN(ExternalPolicyLoader);
58 } // namespace extensions
60 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_