| 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:
|
|
|