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

Unified 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 side-by-side diff with in-line comments
Download patch
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..ebfb18b7f7edb783ab46e9b3356fb10b6c69b985 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
+// |allow_recommended| and |allow_mandatory| flags indicate the levels at which
+// the policy can be set. A value set at an unsupported level will be ignored.
+class POLICY_EXPORT SimpleSchemaValidatingPolicyHandler
+ : public SchemaValidatingPolicyHandler {
+ public:
+ 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.
+ const char* pref_path,
+ Schema schema,
+ SchemaOnErrorStrategy strategy);
+ SimpleSchemaValidatingPolicyHandler(const char* policy_name,
+ const char* pref_path,
+ Schema schema,
+ SchemaOnErrorStrategy strategy,
+ 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.
+ 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.

Powered by Google App Engine
This is Rietveld 408576698