| OLD | NEW |
| 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 CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 virtual void ApplyPolicySettings(const PolicyMap& policies, | 212 virtual void ApplyPolicySettings(const PolicyMap& policies, |
| 213 PrefValueMap* prefs) OVERRIDE; | 213 PrefValueMap* prefs) OVERRIDE; |
| 214 | 214 |
| 215 private: | 215 private: |
| 216 // Name of the pref to write. | 216 // Name of the pref to write. |
| 217 const char* pref_path_; | 217 const char* pref_path_; |
| 218 | 218 |
| 219 DISALLOW_COPY_AND_ASSIGN(IntPercentageToDoublePolicyHandler); | 219 DISALLOW_COPY_AND_ASSIGN(IntPercentageToDoublePolicyHandler); |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 // A policy handler implementation that ensures an int policy's value is part of |
| 223 // an allowed set of values. Rejects values not found in the set. |
| 224 class IntSetPolicyHandler : public TypeCheckingPolicyHandler { |
| 225 public: |
| 226 IntSetPolicyHandler(const char* policy_name, |
| 227 const char* pref_path, |
| 228 const int* allowed_set_begin, |
| 229 const int* allowed_set_end); |
| 230 virtual ~IntSetPolicyHandler(); |
| 231 |
| 232 // ConfigurationPolicyHandler: |
| 233 virtual bool CheckPolicySettings(const PolicyMap& policies, |
| 234 PolicyErrorMap* errors) OVERRIDE; |
| 235 virtual void ApplyPolicySettings(const PolicyMap& policies, |
| 236 PrefValueMap* prefs) OVERRIDE; |
| 237 |
| 238 private: |
| 239 // Checks that the value is part of the allowed set. Returns false if the |
| 240 // value cannot be parsed or is not found in the set. |
| 241 bool EnsureInAllowedSet(const base::Value* value, |
| 242 PolicyErrorMap* errors); |
| 243 |
| 244 // Name of the pref to write. |
| 245 const char* pref_path_; |
| 246 |
| 247 // The allowed set of values. |
| 248 const int* allowed_set_begin_; |
| 249 const int* allowed_set_end_; |
| 250 |
| 251 DISALLOW_COPY_AND_ASSIGN(IntSetPolicyHandler); |
| 252 }; |
| 253 |
| 222 // Implements additional checks for policies that are lists of extension IDs. | 254 // Implements additional checks for policies that are lists of extension IDs. |
| 223 class ExtensionListPolicyHandler : public TypeCheckingPolicyHandler { | 255 class ExtensionListPolicyHandler : public TypeCheckingPolicyHandler { |
| 224 public: | 256 public: |
| 225 ExtensionListPolicyHandler(const char* policy_name, | 257 ExtensionListPolicyHandler(const char* policy_name, |
| 226 const char* pref_path, | 258 const char* pref_path, |
| 227 bool allow_wildcards); | 259 bool allow_wildcards); |
| 228 virtual ~ExtensionListPolicyHandler(); | 260 virtual ~ExtensionListPolicyHandler(); |
| 229 | 261 |
| 230 // ConfigurationPolicyHandler methods: | 262 // ConfigurationPolicyHandler methods: |
| 231 virtual bool CheckPolicySettings(const PolicyMap& policies, | 263 virtual bool CheckPolicySettings(const PolicyMap& policies, |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 private: | 567 private: |
| 536 void ApplyPolicySettingsFromHomePage(const PolicyMap& policies, | 568 void ApplyPolicySettingsFromHomePage(const PolicyMap& policies, |
| 537 PrefValueMap* prefs); | 569 PrefValueMap* prefs); |
| 538 | 570 |
| 539 DISALLOW_COPY_AND_ASSIGN(RestoreOnStartupPolicyHandler); | 571 DISALLOW_COPY_AND_ASSIGN(RestoreOnStartupPolicyHandler); |
| 540 }; | 572 }; |
| 541 | 573 |
| 542 } // namespace policy | 574 } // namespace policy |
| 543 | 575 |
| 544 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ | 576 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ |
| OLD | NEW |