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

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: Fix for the windows compile error 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 // |recommended_permission| and |mandatory_permission| flags indicate the levels
280 // at which the policy can be set. A value set at an unsupported level will be
281 // ignored.
282 class POLICY_EXPORT SimpleSchemaValidatingPolicyHandler
283 : public SchemaValidatingPolicyHandler {
284 public:
285 enum MandatoryPermission { MANDATORY_ALLOWED, MANDATORY_PROHIBITED };
286 enum RecommendedPermission { RECOMMENDED_ALLOWED, RECOMMENDED_PROHIBITED };
287
288 SimpleSchemaValidatingPolicyHandler(
289 const char* policy_name,
290 const char* pref_path,
291 Schema schema,
292 SchemaOnErrorStrategy strategy,
293 RecommendedPermission recommended_permission,
294 MandatoryPermission mandatory_permission);
295 virtual ~SimpleSchemaValidatingPolicyHandler();
296
297 // ConfigurationPolicyHandler:
298 virtual bool CheckPolicySettings(const PolicyMap& policies,
299 PolicyErrorMap* errors) OVERRIDE;
300 virtual void ApplyPolicySettings(const PolicyMap& policies,
301 PrefValueMap* prefs) OVERRIDE;
302
303 private:
304 const char* pref_path_;
305 const bool allow_recommended_;
306 const bool allow_mandatory_;
307
308 DISALLOW_COPY_AND_ASSIGN(SimpleSchemaValidatingPolicyHandler);
309 };
310
276 // A policy handler to deprecate multiple legacy policies with a new one. 311 // 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 312 // This handler will completely ignore any of legacy policy values if the new
278 // one is set. 313 // one is set.
279 class POLICY_EXPORT LegacyPoliciesDeprecatingPolicyHandler 314 class POLICY_EXPORT LegacyPoliciesDeprecatingPolicyHandler
280 : public ConfigurationPolicyHandler { 315 : public ConfigurationPolicyHandler {
281 public: 316 public:
282 LegacyPoliciesDeprecatingPolicyHandler( 317 LegacyPoliciesDeprecatingPolicyHandler(
283 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers, 318 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers,
284 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler); 319 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler);
285 virtual ~LegacyPoliciesDeprecatingPolicyHandler(); 320 virtual ~LegacyPoliciesDeprecatingPolicyHandler();
286 321
287 // ConfigurationPolicyHandler: 322 // ConfigurationPolicyHandler:
288 virtual bool CheckPolicySettings(const PolicyMap& policies, 323 virtual bool CheckPolicySettings(const PolicyMap& policies,
289 PolicyErrorMap* errors) OVERRIDE; 324 PolicyErrorMap* errors) OVERRIDE;
290 virtual void ApplyPolicySettings(const PolicyMap& policies, 325 virtual void ApplyPolicySettings(const PolicyMap& policies,
291 PrefValueMap* prefs) OVERRIDE; 326 PrefValueMap* prefs) OVERRIDE;
292 327
293 private: 328 private:
294 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_; 329 ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_;
295 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_; 330 scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_;
296 331
297 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler); 332 DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler);
298 }; 333 };
299 334
300 } // namespace policy 335 } // namespace policy
301 336
302 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_ 337 #endif // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/test/data/policy/policy_test_cases.json ('k') | components/policy/core/browser/configuration_policy_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698