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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 18 matching lines...) Expand all Loading... |
29 struct POLICY_EXPORT PolicyToPreferenceMapEntry { | 29 struct POLICY_EXPORT PolicyToPreferenceMapEntry { |
30 const char* const policy_name; | 30 const char* const policy_name; |
31 const char* const preference_path; | 31 const char* const preference_path; |
32 const base::Value::Type value_type; | 32 const base::Value::Type value_type; |
33 }; | 33 }; |
34 | 34 |
35 // An abstract super class that subclasses should implement to map policies to | 35 // An abstract super class that subclasses should implement to map policies to |
36 // their corresponding preferences, and to check whether the policies are valid. | 36 // their corresponding preferences, and to check whether the policies are valid. |
37 class POLICY_EXPORT ConfigurationPolicyHandler { | 37 class POLICY_EXPORT ConfigurationPolicyHandler { |
38 public: | 38 public: |
| 39 // TODO(thestig): Replace with base::Value::GetTypeName(). |
39 static std::string ValueTypeToString(base::Value::Type type); | 40 static std::string ValueTypeToString(base::Value::Type type); |
40 | 41 |
41 ConfigurationPolicyHandler(); | 42 ConfigurationPolicyHandler(); |
42 virtual ~ConfigurationPolicyHandler(); | 43 virtual ~ConfigurationPolicyHandler(); |
43 | 44 |
44 // Returns whether the policy settings handled by this | 45 // Returns whether the policy settings handled by this |
45 // ConfigurationPolicyHandler can be applied. Fills |errors| with error | 46 // ConfigurationPolicyHandler can be applied. Fills |errors| with error |
46 // messages or warnings. |errors| may contain error messages even when | 47 // messages or warnings. |errors| may contain error messages even when |
47 // |CheckPolicySettings()| returns true. | 48 // |CheckPolicySettings()| returns true. |
48 virtual bool CheckPolicySettings(const PolicyMap& policies, | 49 virtual bool CheckPolicySettings(const PolicyMap& policies, |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 private: | 355 private: |
355 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_; | 356 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_; |
356 std::unique_ptr<SchemaValidatingPolicyHandler> new_policy_handler_; | 357 std::unique_ptr<SchemaValidatingPolicyHandler> new_policy_handler_; |
357 | 358 |
358 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler); | 359 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler); |
359 }; | 360 }; |
360 | 361 |
361 } // namespace policy | 362 } // namespace policy |
362 | 363 |
363 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ | 364 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ |
OLD | NEW |