| 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 |
| 68 const char* pref_name() const { return pref_name_; } |
| 69 |
| 64 private: | 70 private: |
| 65 // Parses the data in |policy_value| and writes them to |extension_dict|. | 71 // Parses the data in |policy_value| and writes them to |extension_dict|. |
| 66 bool ParseList(const base::Value* policy_value, | 72 bool ParseList(const base::Value* policy_value, |
| 67 base::DictionaryValue* extension_dict, | 73 base::DictionaryValue* extension_dict, |
| 68 policy::PolicyErrorMap* errors); | 74 policy::PolicyErrorMap* errors); |
| 69 | 75 |
| 76 const char* const pref_name_ = nullptr; |
| 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallListPolicyHandler); |
| 79 }; |
| 80 |
| 81 // Parses the extension force install list for user sessions. |
| 82 class ExtensionInstallForcelistPolicyHandler |
| 83 : public ExtensionInstallListPolicyHandler { |
| 84 public: |
| 85 ExtensionInstallForcelistPolicyHandler(); |
| 86 ~ExtensionInstallForcelistPolicyHandler() override = default; |
| 87 |
| 88 private: |
| 70 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallForcelistPolicyHandler); | 89 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallForcelistPolicyHandler); |
| 71 }; | 90 }; |
| 72 | 91 |
| 92 // Parses the extension force install list for the login profile. |
| 93 class ExtensionInstallLoginScreenAppListPolicyHandler |
| 94 : public ExtensionInstallListPolicyHandler { |
| 95 public: |
| 96 ExtensionInstallLoginScreenAppListPolicyHandler(); |
| 97 ~ExtensionInstallLoginScreenAppListPolicyHandler() override = default; |
| 98 |
| 99 private: |
| 100 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallLoginScreenAppListPolicyHandler); |
| 101 }; |
| 102 |
| 73 // Implements additional checks for policies that are lists of extension | 103 // Implements additional checks for policies that are lists of extension |
| 74 // URLPatterns. | 104 // URLPatterns. |
| 75 class ExtensionURLPatternListPolicyHandler | 105 class ExtensionURLPatternListPolicyHandler |
| 76 : public policy::TypeCheckingPolicyHandler { | 106 : public policy::TypeCheckingPolicyHandler { |
| 77 public: | 107 public: |
| 78 ExtensionURLPatternListPolicyHandler(const char* policy_name, | 108 ExtensionURLPatternListPolicyHandler(const char* policy_name, |
| 79 const char* pref_path); | 109 const char* pref_path); |
| 80 ~ExtensionURLPatternListPolicyHandler() override; | 110 ~ExtensionURLPatternListPolicyHandler() override; |
| 81 | 111 |
| 82 // ConfigurationPolicyHandler methods: | 112 // ConfigurationPolicyHandler methods: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 103 void ApplyPolicySettings(const policy::PolicyMap& policies, | 133 void ApplyPolicySettings(const policy::PolicyMap& policies, |
| 104 PrefValueMap* prefs) override; | 134 PrefValueMap* prefs) override; |
| 105 | 135 |
| 106 private: | 136 private: |
| 107 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsPolicyHandler); | 137 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsPolicyHandler); |
| 108 }; | 138 }; |
| 109 | 139 |
| 110 } // namespace extensions | 140 } // namespace extensions |
| 111 | 141 |
| 112 #endif // CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_ | 142 #endif // CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_ |
| OLD | NEW |