| 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_POLICY_MAP_H_ | 5 #ifndef CHROME_BROWSER_POLICY_POLICY_MAP_H_ |
| 6 #define CHROME_BROWSER_POLICY_POLICY_MAP_H_ | 6 #define CHROME_BROWSER_POLICY_POLICY_MAP_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/policy/policy_constants.h" |
| 14 | 15 |
| 15 namespace policy { | 16 namespace policy { |
| 16 | 17 |
| 17 struct PolicyDefinitionList; | 18 struct PolicyDefinitionList; |
| 18 | 19 |
| 19 // The level of a policy determines its enforceability and whether users can | |
| 20 // override it or not. The values are listed in increasing order of priority. | |
| 21 enum PolicyLevel { | |
| 22 // RECOMMENDED policies can be overridden by users. They are meant as a | |
| 23 // default value configured by admins, that users can customize. | |
| 24 POLICY_LEVEL_RECOMMENDED, | |
| 25 | |
| 26 // MANDATORY policies must be enforced and users can't circumvent them. | |
| 27 POLICY_LEVEL_MANDATORY, | |
| 28 }; | |
| 29 | |
| 30 // The scope of a policy flags whether it is meant to be applied to the current | |
| 31 // user or to the machine. | |
| 32 enum PolicyScope { | |
| 33 // USER policies apply to sessions of the current user. | |
| 34 POLICY_SCOPE_USER, | |
| 35 | |
| 36 // MACHINE policies apply to any users of the current machine. | |
| 37 POLICY_SCOPE_MACHINE, | |
| 38 }; | |
| 39 | |
| 40 // A mapping of policy names to policy values for a given policy namespace. | 20 // A mapping of policy names to policy values for a given policy namespace. |
| 41 class PolicyMap { | 21 class PolicyMap { |
| 42 public: | 22 public: |
| 43 // Each policy maps to an Entry which keeps the policy value as well as other | 23 // Each policy maps to an Entry which keeps the policy value as well as other |
| 44 // relevant data about the policy. | 24 // relevant data about the policy. |
| 45 struct Entry { | 25 struct Entry { |
| 46 PolicyLevel level; | 26 PolicyLevel level; |
| 47 PolicyScope scope; | 27 PolicyScope scope; |
| 48 Value* value; | 28 Value* value; |
| 49 | 29 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const PolicyMapType::value_type& b); | 110 const PolicyMapType::value_type& b); |
| 131 | 111 |
| 132 PolicyMapType map_; | 112 PolicyMapType map_; |
| 133 | 113 |
| 134 DISALLOW_COPY_AND_ASSIGN(PolicyMap); | 114 DISALLOW_COPY_AND_ASSIGN(PolicyMap); |
| 135 }; | 115 }; |
| 136 | 116 |
| 137 } // namespace policy | 117 } // namespace policy |
| 138 | 118 |
| 139 #endif // CHROME_BROWSER_POLICY_POLICY_MAP_H_ | 119 #endif // CHROME_BROWSER_POLICY_POLICY_MAP_H_ |
| OLD | NEW |