Chromium Code Reviews| Index: components/policy/core/browser/configuration_policy_handler.h |
| diff --git a/components/policy/core/browser/configuration_policy_handler.h b/components/policy/core/browser/configuration_policy_handler.h |
| index 814f65b8f542273ccdd7a975b9afa858f833850a..5fd015282656eb4c1dce9b54bd102e156ae0cff8 100644 |
| --- a/components/policy/core/browser/configuration_policy_handler.h |
| +++ b/components/policy/core/browser/configuration_policy_handler.h |
| @@ -273,6 +273,40 @@ class POLICY_EXPORT SchemaValidatingPolicyHandler |
| DISALLOW_COPY_AND_ASSIGN(SchemaValidatingPolicyHandler); |
| }; |
| +// Maps policy to pref like SimplePolicyHandler while ensuring that the value |
| +// set matches the schema. |schema| is the schema used for policies, and |
| +// |strategy| is the strategy used for schema validation errors. The flags |
| +// |allow_recommended| and |allow_mandatory| enables the handler for recommended |
|
bartfab (slow)
2014/06/06 12:01:57
Nit 1: s/enables/enable/
Nit 2: It would be good t
kaliamoorthi
2014/06/10 17:14:26
Done.
|
| +// and mandatory policy levels when set to true. |
| +class POLICY_EXPORT SimpleSchemaValidatingPolicyHandler |
| + : public SchemaValidatingPolicyHandler { |
| + public: |
| + SimpleSchemaValidatingPolicyHandler(const char* policy_name, |
| + const char* pref_path, |
| + Schema schema, |
| + SchemaOnErrorStrategy strategy); |
| + SimpleSchemaValidatingPolicyHandler(const char* policy_name, |
| + const char* pref_path, |
| + Schema schema, |
| + SchemaOnErrorStrategy strategy, |
| + bool allow_recommended, |
| + bool allow_mandatory); |
| + virtual ~SimpleSchemaValidatingPolicyHandler(); |
| + |
| + // ConfigurationPolicyHandler: |
| + virtual bool CheckPolicySettings(const PolicyMap& policies, |
| + PolicyErrorMap* errors) OVERRIDE; |
| + virtual void ApplyPolicySettings(const PolicyMap& policies, |
| + PrefValueMap* prefs) OVERRIDE; |
| + |
| + private: |
| + const char* pref_path_; |
| + const bool allow_recommended_; |
| + const bool allow_mandatory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SimpleSchemaValidatingPolicyHandler); |
| +}; |
| + |
| // A policy handler to deprecate multiple legacy policies with a new one. |
| // This handler will completely ignore any of legacy policy values if the new |
| // one is set. |