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

Unified Diff: chrome/browser/policy/configuration_policy_handler.h

Issue 18153007: Add policies to control power management on the Chrome OS login screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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: chrome/browser/policy/configuration_policy_handler.h
diff --git a/chrome/browser/policy/configuration_policy_handler.h b/chrome/browser/policy/configuration_policy_handler.h
index 449a11a10085f25af1fc7d895f2e58e957bab9b1..f9a1361bac43a3c167d1ad269a9a8d0508411a5a 100644
--- a/chrome/browser/policy/configuration_policy_handler.h
+++ b/chrome/browser/policy/configuration_policy_handler.h
@@ -219,6 +219,38 @@ class IntPercentageToDoublePolicyHandler : public IntRangePolicyHandlerBase {
DISALLOW_COPY_AND_ASSIGN(IntPercentageToDoublePolicyHandler);
};
+// A policy handler implementation that ensures an int policy's value is part of
+// an allowed set of values. Rejects values not found in the set.
+class IntSetPolicyHandler : public TypeCheckingPolicyHandler {
+ public:
+ IntSetPolicyHandler(const char* policy_name,
+ const char* pref_path,
+ const int* allowed_set_begin,
+ const int* allowed_set_end);
+ virtual ~IntSetPolicyHandler();
+
+ // ConfigurationPolicyHandler:
+ virtual bool CheckPolicySettings(const PolicyMap& policies,
+ PolicyErrorMap* errors) OVERRIDE;
+ virtual void ApplyPolicySettings(const PolicyMap& policies,
+ PrefValueMap* prefs) OVERRIDE;
+
+ private:
+ // Checks that the value is part of the allowed set. Returns false if the
+ // value cannot be parsed or is not found in the set.
+ bool EnsureInAllowedSet(const base::Value* value,
+ PolicyErrorMap* errors);
+
+ // Name of the pref to write.
+ const char* pref_path_;
+
+ // The allowed set of values.
+ const int* allowed_set_begin_;
+ const int* allowed_set_end_;
+
+ DISALLOW_COPY_AND_ASSIGN(IntSetPolicyHandler);
+};
+
// Implements additional checks for policies that are lists of extension IDs.
class ExtensionListPolicyHandler : public TypeCheckingPolicyHandler {
public:

Powered by Google App Engine
This is Rietveld 408576698