OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ |
6 #define COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ | 6 #define COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 struct POLICY_EXPORT PolicyToPreferenceMapEntry { | 24 struct POLICY_EXPORT PolicyToPreferenceMapEntry { |
25 const char* const policy_name; | 25 const char* const policy_name; |
26 const char* const preference_path; | 26 const char* const preference_path; |
27 const base::Value::Type value_type; | 27 const base::Value::Type value_type; |
28 }; | 28 }; |
29 | 29 |
30 // An abstract super class that subclasses should implement to map policies to | 30 // An abstract super class that subclasses should implement to map policies to |
31 // their corresponding preferences, and to check whether the policies are valid. | 31 // their corresponding preferences, and to check whether the policies are valid. |
32 class POLICY_EXPORT ConfigurationPolicyHandler { | 32 class POLICY_EXPORT ConfigurationPolicyHandler { |
33 public: | 33 public: |
34 static std::string ValueTypeToString(Value::Type type); | 34 static std::string ValueTypeToString(base::Value::Type type); |
35 | 35 |
36 ConfigurationPolicyHandler(); | 36 ConfigurationPolicyHandler(); |
37 virtual ~ConfigurationPolicyHandler(); | 37 virtual ~ConfigurationPolicyHandler(); |
38 | 38 |
39 // Returns whether the policy settings handled by this | 39 // Returns whether the policy settings handled by this |
40 // ConfigurationPolicyHandler can be applied. Fills |errors| with error | 40 // ConfigurationPolicyHandler can be applied. Fills |errors| with error |
41 // messages or warnings. |errors| may contain error messages even when | 41 // messages or warnings. |errors| may contain error messages even when |
42 // |CheckPolicySettings()| returns true. | 42 // |CheckPolicySettings()| returns true. |
43 virtual bool CheckPolicySettings(const PolicyMap& policies, | 43 virtual bool CheckPolicySettings(const PolicyMap& policies, |
44 PolicyErrorMap* errors) = 0; | 44 PolicyErrorMap* errors) = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
69 // ConfigurationPolicyHandler methods: | 69 // ConfigurationPolicyHandler methods: |
70 virtual bool CheckPolicySettings(const PolicyMap& policies, | 70 virtual bool CheckPolicySettings(const PolicyMap& policies, |
71 PolicyErrorMap* errors) OVERRIDE; | 71 PolicyErrorMap* errors) OVERRIDE; |
72 | 72 |
73 const char* policy_name() const; | 73 const char* policy_name() const; |
74 | 74 |
75 protected: | 75 protected: |
76 // Runs policy checks and returns the policy value if successful. | 76 // Runs policy checks and returns the policy value if successful. |
77 bool CheckAndGetValue(const PolicyMap& policies, | 77 bool CheckAndGetValue(const PolicyMap& policies, |
78 PolicyErrorMap* errors, | 78 PolicyErrorMap* errors, |
79 const Value** value); | 79 const base::Value** value); |
80 | 80 |
81 private: | 81 private: |
82 // The name of the policy. | 82 // The name of the policy. |
83 const char* policy_name_; | 83 const char* policy_name_; |
84 | 84 |
85 // The type the value of the policy should have. | 85 // The type the value of the policy should have. |
86 base::Value::Type value_type_; | 86 base::Value::Type value_type_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(TypeCheckingPolicyHandler); | 88 DISALLOW_COPY_AND_ASSIGN(TypeCheckingPolicyHandler); |
89 }; | 89 }; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 private: | 225 private: |
226 // Name of the pref to write. | 226 // Name of the pref to write. |
227 const char* pref_path_; | 227 const char* pref_path_; |
228 | 228 |
229 DISALLOW_COPY_AND_ASSIGN(IntPercentageToDoublePolicyHandler); | 229 DISALLOW_COPY_AND_ASSIGN(IntPercentageToDoublePolicyHandler); |
230 }; | 230 }; |
231 | 231 |
232 } // namespace policy | 232 } // namespace policy |
233 | 233 |
234 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ | 234 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ |
OLD | NEW |