Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: components/policy/core/browser/configuration_policy_handler.h

Issue 309553011: Enable policy support for registering protocol handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Issue_116119_pre
Patch Set: Fixes nits Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // Maps policy to pref like SimplePolicyHandler while ensuring that the value
277 // set matches the schema. |schema| is the schema used for policies, and
278 // |strategy| is the strategy used for schema validation errors. The
279 // |allow_recommended| and |allow_mandatory| flags indicate the levels at which
280 // the policy can be set. A value set at an unsupported level will be ignored.
281 class POLICY_EXPORT SimpleSchemaValidatingPolicyHandler
282 : public SchemaValidatingPolicyHandler {
283 public:
284 SimpleSchemaValidatingPolicyHandler(const char* policy_name,
bartfab (slow) 2014/06/11 10:08:44 This constructor is not used anywhere.
Andrew T Wilson (Slow) 2014/06/11 12:32:55 If you are going to leave this constructor in plac
kaliamoorthi 2014/06/13 13:22:27 I have removed it.
kaliamoorthi 2014/06/13 13:22:27 I have removed it.
285 const char* pref_path,
286 Schema schema,
287 SchemaOnErrorStrategy strategy);
288 SimpleSchemaValidatingPolicyHandler(const char* policy_name,
289 const char* pref_path,
290 Schema schema,
291 SchemaOnErrorStrategy strategy,
292 bool allow_recommended,
Andrew T Wilson (Slow) 2014/06/11 12:32:55 nit: I don't like passing raw bools around to cons
kaliamoorthi 2014/06/13 13:22:27 Done.
293 bool allow_mandatory);
294 virtual ~SimpleSchemaValidatingPolicyHandler();
295
296 // ConfigurationPolicyHandler:
297 virtual bool CheckPolicySettings(const PolicyMap& policies,
298 PolicyErrorMap* errors) OVERRIDE;
299 virtual void ApplyPolicySettings(const PolicyMap& policies,
300 PrefValueMap* prefs) OVERRIDE;
301
302 private:
303 const char* pref_path_;
304 const bool allow_recommended_;
305 const bool allow_mandatory_;
306
307 DISALLOW_COPY_AND_ASSIGN(SimpleSchemaValidatingPolicyHandler);
308 };
309
276 // A policy handler to deprecate multiple legacy policies with a new one. 310 // 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 311 // This handler will completely ignore any of legacy policy values if the new
278 // one is set. 312 // one is set.
279 class POLICY_EXPORT LegacyPoliciesDeprecatingPolicyHandler 313 class POLICY_EXPORT LegacyPoliciesDeprecatingPolicyHandler
280 : public ConfigurationPolicyHandler { 314 : public ConfigurationPolicyHandler {
281 public: 315 public:
282 LegacyPoliciesDeprecatingPolicyHandler( 316 LegacyPoliciesDeprecatingPolicyHandler(
283 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers, 317 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers,
284 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler); 318 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler);
285 virtual ~LegacyPoliciesDeprecatingPolicyHandler(); 319 virtual ~LegacyPoliciesDeprecatingPolicyHandler();
286 320
287 // ConfigurationPolicyHandler: 321 // ConfigurationPolicyHandler:
288 virtual bool CheckPolicySettings(const PolicyMap& policies, 322 virtual bool CheckPolicySettings(const PolicyMap& policies,
289 PolicyErrorMap* errors) OVERRIDE; 323 PolicyErrorMap* errors) OVERRIDE;
290 virtual void ApplyPolicySettings(const PolicyMap& policies, 324 virtual void ApplyPolicySettings(const PolicyMap& policies,
291 PrefValueMap* prefs) OVERRIDE; 325 PrefValueMap* prefs) OVERRIDE;
292 326
293 private: 327 private:
294 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_; 328 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_;
295 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_; 329 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_;
296 330
297 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler); 331 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler);
298 }; 332 };
299 333
300 } // namespace policy 334 } // namespace policy
301 335
302 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ 336 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698