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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 scoped_ptr<base::Value>* output); | 266 scoped_ptr<base::Value>* output); |
267 | 267 |
268 private: | 268 private: |
269 const char* policy_name_; | 269 const char* policy_name_; |
270 Schema schema_; | 270 Schema schema_; |
271 SchemaOnErrorStrategy strategy_; | 271 SchemaOnErrorStrategy strategy_; |
272 | 272 |
273 DISALLOW_COPY_AND_ASSIGN(SchemaValidatingPolicyHandler); | 273 DISALLOW_COPY_AND_ASSIGN(SchemaValidatingPolicyHandler); |
274 }; | 274 }; |
275 | 275 |
276 class POLICY_EXPORT SimpleSchemaValidatingPolicyHandler | |
bartfab (slow)
2014/06/03 11:58:21
1: Document the properties of this policy handler
kaliamoorthi
2014/06/04 18:01:58
Done.
| |
277 : public SchemaValidatingPolicyHandler { | |
278 public: | |
279 SimpleSchemaValidatingPolicyHandler(const char* policy_name, | |
280 const char* pref_path, | |
281 Schema schema, | |
282 SchemaOnErrorStrategy strategy); | |
283 SimpleSchemaValidatingPolicyHandler(const char* policy_name, | |
284 const char* pref_path, | |
285 Schema schema, | |
286 SchemaOnErrorStrategy strategy, | |
287 bool recommended, | |
288 bool mandatory); | |
bartfab (slow)
2014/06/03 11:58:21
Nit: How about renaming these to something like |a
kaliamoorthi
2014/06/04 18:01:58
Done.
| |
289 virtual ~SimpleSchemaValidatingPolicyHandler(); | |
290 | |
291 // ConfigurationPolicyHandler: | |
292 virtual bool CheckPolicySettings(const PolicyMap& policies, | |
293 PolicyErrorMap* errors) OVERRIDE; | |
294 | |
bartfab (slow)
2014/06/03 11:58:21
Nit: Remove blank line.
kaliamoorthi
2014/06/04 18:01:58
Done.
| |
295 virtual void ApplyPolicySettings(const PolicyMap& policies, | |
296 PrefValueMap* prefs) OVERRIDE; | |
297 | |
298 private: | |
299 const char* pref_path_; | |
300 bool recommended_; | |
bartfab (slow)
2014/06/03 11:58:21
Nit: const.
kaliamoorthi
2014/06/04 18:01:58
Done.
| |
301 bool mandatory_; | |
bartfab (slow)
2014/06/03 11:58:21
Nit: const.
kaliamoorthi
2014/06/04 18:01:58
Done.
| |
302 | |
303 DISALLOW_COPY_AND_ASSIGN(SimpleSchemaValidatingPolicyHandler); | |
304 }; | |
305 | |
276 // A policy handler to deprecate multiple legacy policies with a new one. | 306 // A policy handler to deprecate multiple legacy policies with a new one. |
277 // This handler will completely ignore any of legacy policy values if the new | 307 // This handler will completely ignore any of legacy policy values if the new |
278 // one is set. | 308 // one is set. |
279 class POLICY_EXPORT LegacyPoliciesDeprecatingPolicyHandler | 309 class POLICY_EXPORT LegacyPoliciesDeprecatingPolicyHandler |
280 : public ConfigurationPolicyHandler { | 310 : public ConfigurationPolicyHandler { |
281 public: | 311 public: |
282 LegacyPoliciesDeprecatingPolicyHandler( | 312 LegacyPoliciesDeprecatingPolicyHandler( |
283 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers, | 313 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers, |
284 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler); | 314 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler); |
285 virtual ~LegacyPoliciesDeprecatingPolicyHandler(); | 315 virtual ~LegacyPoliciesDeprecatingPolicyHandler(); |
286 | 316 |
287 // ConfigurationPolicyHandler: | 317 // ConfigurationPolicyHandler: |
288 virtual bool CheckPolicySettings(const PolicyMap& policies, | 318 virtual bool CheckPolicySettings(const PolicyMap& policies, |
289 PolicyErrorMap* errors) OVERRIDE; | 319 PolicyErrorMap* errors) OVERRIDE; |
290 virtual void ApplyPolicySettings(const PolicyMap& policies, | 320 virtual void ApplyPolicySettings(const PolicyMap& policies, |
291 PrefValueMap* prefs) OVERRIDE; | 321 PrefValueMap* prefs) OVERRIDE; |
292 | 322 |
293 private: | 323 private: |
294 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_; | 324 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_; |
295 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_; | 325 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_; |
296 | 326 |
297 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler); | 327 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler); |
298 }; | 328 }; |
299 | 329 |
300 } // namespace policy | 330 } // namespace policy |
301 | 331 |
302 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ | 332 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ |
OLD | NEW |