OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 policy::PolicyErrorMap* errors, | 42 policy::PolicyErrorMap* errors, |
43 std::unique_ptr<base::ListValue>* extension_ids); | 43 std::unique_ptr<base::ListValue>* extension_ids); |
44 | 44 |
45 private: | 45 private: |
46 const char* pref_path_; | 46 const char* pref_path_; |
47 bool allow_wildcards_; | 47 bool allow_wildcards_; |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(ExtensionListPolicyHandler); | 49 DISALLOW_COPY_AND_ASSIGN(ExtensionListPolicyHandler); |
50 }; | 50 }; |
51 | 51 |
52 class ExtensionInstallForcelistPolicyHandler | 52 // Base class for parsing the list of extensions to force install. |
| 53 class ExtensionInstallListPolicyHandler |
53 : public policy::TypeCheckingPolicyHandler { | 54 : public policy::TypeCheckingPolicyHandler { |
54 public: | 55 public: |
55 ExtensionInstallForcelistPolicyHandler(); | |
56 ~ExtensionInstallForcelistPolicyHandler() override; | |
57 | |
58 // ConfigurationPolicyHandler methods: | 56 // ConfigurationPolicyHandler methods: |
59 bool CheckPolicySettings(const policy::PolicyMap& policies, | 57 bool CheckPolicySettings(const policy::PolicyMap& policies, |
60 policy::PolicyErrorMap* errors) override; | 58 policy::PolicyErrorMap* errors) override; |
61 void ApplyPolicySettings(const policy::PolicyMap& policies, | 59 void ApplyPolicySettings(const policy::PolicyMap& policies, |
62 PrefValueMap* prefs) override; | 60 PrefValueMap* prefs) override; |
63 | 61 |
| 62 protected: |
| 63 ExtensionInstallListPolicyHandler(const char* policy_name, |
| 64 const char* pref_name); |
| 65 |
| 66 ~ExtensionInstallListPolicyHandler() override = default; |
| 67 |
64 private: | 68 private: |
65 // Parses the data in |policy_value| and writes them to |extension_dict|. | 69 // Parses the data in |policy_value| and writes them to |extension_dict|. |
66 bool ParseList(const base::Value* policy_value, | 70 bool ParseList(const base::Value* policy_value, |
67 base::DictionaryValue* extension_dict, | 71 base::DictionaryValue* extension_dict, |
68 policy::PolicyErrorMap* errors); | 72 policy::PolicyErrorMap* errors); |
69 | 73 |
| 74 const char* const pref_name_ = nullptr; |
| 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallListPolicyHandler); |
| 77 }; |
| 78 |
| 79 // Parses the extension force install list for user sessions. |
| 80 class ExtensionInstallForcelistPolicyHandler |
| 81 : public ExtensionInstallListPolicyHandler { |
| 82 public: |
| 83 ExtensionInstallForcelistPolicyHandler(); |
| 84 ~ExtensionInstallForcelistPolicyHandler() override = default; |
| 85 |
| 86 private: |
70 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallForcelistPolicyHandler); | 87 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallForcelistPolicyHandler); |
71 }; | 88 }; |
72 | 89 |
| 90 // Parses the extension force install list for the login profile. |
| 91 class ExtensionInstallLoginScreenAppListPolicyHandler |
| 92 : public ExtensionInstallListPolicyHandler { |
| 93 public: |
| 94 ExtensionInstallLoginScreenAppListPolicyHandler(); |
| 95 ~ExtensionInstallLoginScreenAppListPolicyHandler() override = default; |
| 96 |
| 97 private: |
| 98 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallLoginScreenAppListPolicyHandler); |
| 99 }; |
| 100 |
73 // Implements additional checks for policies that are lists of extension | 101 // Implements additional checks for policies that are lists of extension |
74 // URLPatterns. | 102 // URLPatterns. |
75 class ExtensionURLPatternListPolicyHandler | 103 class ExtensionURLPatternListPolicyHandler |
76 : public policy::TypeCheckingPolicyHandler { | 104 : public policy::TypeCheckingPolicyHandler { |
77 public: | 105 public: |
78 ExtensionURLPatternListPolicyHandler(const char* policy_name, | 106 ExtensionURLPatternListPolicyHandler(const char* policy_name, |
79 const char* pref_path); | 107 const char* pref_path); |
80 ~ExtensionURLPatternListPolicyHandler() override; | 108 ~ExtensionURLPatternListPolicyHandler() override; |
81 | 109 |
82 // ConfigurationPolicyHandler methods: | 110 // ConfigurationPolicyHandler methods: |
(...skipping 20 matching lines...) Expand all Loading... |
103 void ApplyPolicySettings(const policy::PolicyMap& policies, | 131 void ApplyPolicySettings(const policy::PolicyMap& policies, |
104 PrefValueMap* prefs) override; | 132 PrefValueMap* prefs) override; |
105 | 133 |
106 private: | 134 private: |
107 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsPolicyHandler); | 135 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsPolicyHandler); |
108 }; | 136 }; |
109 | 137 |
110 } // namespace extensions | 138 } // namespace extensions |
111 | 139 |
112 #endif // CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_ | 140 #endif // CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_ |
OLD | NEW |