OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/policy/configuration_policy_handler_list.h" | 5 #include "chrome/browser/policy/configuration_policy_handler_list.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/policy/configuration_policy_handler.h" | 9 #include "chrome/browser/policy/configuration_policy_handler.h" |
10 #include "chrome/browser/policy/policy_error_map.h" | 10 #include "chrome/browser/policy/policy_error_map.h" |
11 #include "chrome/browser/policy/policy_map.h" | 11 #include "chrome/browser/policy/policy_map.h" |
12 #include "chrome/browser/prefs/pref_value_map.h" | 12 #include "chrome/browser/prefs/pref_value_map.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "policy/policy_constants.h" | 15 #include "policy/policy_constants.h" |
16 | 16 |
17 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
18 #include "chrome/browser/policy/configuration_policy_handler_chromeos.h" | 18 #include "chrome/browser/policy/configuration_policy_handler_chromeos.h" |
19 #endif | 19 #endif // defined(OS_CHROMEOS) |
20 | 20 |
21 namespace policy { | 21 namespace policy { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 // Maps a policy type to a preference path, and to the expected value type. | 25 // Maps a policy type to a preference path, and to the expected value type. |
26 // This is the entry type of |kSimplePolicyMap| below. | 26 // This is the entry type of |kSimplePolicyMap| below. |
27 struct PolicyToPreferenceMapEntry { | 27 struct PolicyToPreferenceMapEntry { |
28 base::Value::Type value_type; | 28 base::Value::Type value_type; |
29 ConfigurationPolicyType policy_type; | 29 ConfigurationPolicyType policy_type; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 { Value::TYPE_STRING, kPolicyEnterpriseWebStoreURL, | 191 { Value::TYPE_STRING, kPolicyEnterpriseWebStoreURL, |
192 prefs::kEnterpriseWebStoreURL }, | 192 prefs::kEnterpriseWebStoreURL }, |
193 { Value::TYPE_STRING, kPolicyEnterpriseWebStoreName, | 193 { Value::TYPE_STRING, kPolicyEnterpriseWebStoreName, |
194 prefs::kEnterpriseWebStoreName }, | 194 prefs::kEnterpriseWebStoreName }, |
195 | 195 |
196 #if defined(OS_CHROMEOS) | 196 #if defined(OS_CHROMEOS) |
197 { Value::TYPE_BOOLEAN, kPolicyChromeOsLockOnIdleSuspend, | 197 { Value::TYPE_BOOLEAN, kPolicyChromeOsLockOnIdleSuspend, |
198 prefs::kEnableScreenLock }, | 198 prefs::kEnableScreenLock }, |
199 { Value::TYPE_STRING, kPolicyChromeOsReleaseChannel, | 199 { Value::TYPE_STRING, kPolicyChromeOsReleaseChannel, |
200 prefs::kChromeOsReleaseChannel }, | 200 prefs::kChromeOsReleaseChannel }, |
201 #endif | 201 #endif // defined(OS_CHROMEOS) |
202 }; | 202 }; |
203 | 203 |
204 } // namespace | 204 } // namespace |
205 | 205 |
206 ConfigurationPolicyHandlerList::ConfigurationPolicyHandlerList() { | 206 ConfigurationPolicyHandlerList::ConfigurationPolicyHandlerList() { |
207 for (size_t i = 0; i < arraysize(kSimplePolicyMap); ++i) { | 207 for (size_t i = 0; i < arraysize(kSimplePolicyMap); ++i) { |
208 handlers_.push_back( | 208 handlers_.push_back( |
209 new SimplePolicyHandler(kSimplePolicyMap[i].policy_type, | 209 new SimplePolicyHandler(kSimplePolicyMap[i].policy_type, |
210 kSimplePolicyMap[i].value_type, | 210 kSimplePolicyMap[i].value_type, |
211 kSimplePolicyMap[i].preference_path)); | 211 kSimplePolicyMap[i].preference_path)); |
212 } | 212 } |
213 | 213 |
214 handlers_.push_back(new AutofillPolicyHandler()); | 214 handlers_.push_back(new AutofillPolicyHandler()); |
215 handlers_.push_back(new DefaultSearchPolicyHandler()); | 215 handlers_.push_back(new DefaultSearchPolicyHandler()); |
216 handlers_.push_back(new DiskCacheDirPolicyHandler()); | 216 handlers_.push_back(new DiskCacheDirPolicyHandler()); |
217 handlers_.push_back(new FileSelectionDialogsHandler()); | 217 handlers_.push_back(new FileSelectionDialogsHandler()); |
218 handlers_.push_back(new IncognitoModePolicyHandler()); | 218 handlers_.push_back(new IncognitoModePolicyHandler()); |
219 handlers_.push_back(new JavascriptPolicyHandler()); | 219 handlers_.push_back(new JavascriptPolicyHandler()); |
220 handlers_.push_back(new ProxyPolicyHandler()); | 220 handlers_.push_back(new ProxyPolicyHandler()); |
221 handlers_.push_back(new SyncPolicyHandler()); | 221 handlers_.push_back(new SyncPolicyHandler()); |
222 | 222 |
223 #if !defined(OS_CHROMEOS) | 223 #if !defined(OS_CHROMEOS) |
224 handlers_.push_back(new DownloadDirPolicyHandler()); | 224 handlers_.push_back(new DownloadDirPolicyHandler()); |
225 #endif // !defined(OS_CHROME0S) | 225 #endif // !defined(OS_CHROMEOS) |
226 | 226 |
227 #if defined(OS_CHROMEOS) | 227 #if defined(OS_CHROMEOS) |
228 handlers_.push_back( | 228 handlers_.push_back( |
229 new NetworkConfigurationPolicyHandler( | 229 new NetworkConfigurationPolicyHandler( |
230 kPolicyDeviceOpenNetworkConfiguration)); | 230 kPolicyDeviceOpenNetworkConfiguration)); |
231 handlers_.push_back( | 231 handlers_.push_back( |
232 new NetworkConfigurationPolicyHandler( | 232 new NetworkConfigurationPolicyHandler( |
233 kPolicyOpenNetworkConfiguration)); | 233 kPolicyOpenNetworkConfiguration)); |
234 #endif | 234 #endif // defined(OS_CHROMEOS) |
235 } | 235 } |
236 | 236 |
237 ConfigurationPolicyHandlerList::~ConfigurationPolicyHandlerList() { | 237 ConfigurationPolicyHandlerList::~ConfigurationPolicyHandlerList() { |
238 STLDeleteElements(&handlers_); | 238 STLDeleteElements(&handlers_); |
239 } | 239 } |
240 | 240 |
241 void ConfigurationPolicyHandlerList::ApplyPolicySettings( | 241 void ConfigurationPolicyHandlerList::ApplyPolicySettings( |
242 const PolicyMap& policies, | 242 const PolicyMap& policies, |
243 PrefValueMap* prefs, | 243 PrefValueMap* prefs, |
244 PolicyErrorMap* errors) const { | 244 PolicyErrorMap* errors) const { |
(...skipping 16 matching lines...) Expand all Loading... |
261 } | 261 } |
262 | 262 |
263 void ConfigurationPolicyHandlerList::PrepareForDisplaying( | 263 void ConfigurationPolicyHandlerList::PrepareForDisplaying( |
264 PolicyMap* policies) const { | 264 PolicyMap* policies) const { |
265 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; | 265 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; |
266 for (handler = handlers_.begin(); handler != handlers_.end(); ++handler) | 266 for (handler = handlers_.begin(); handler != handlers_.end(); ++handler) |
267 (*handler)->PrepareForDisplaying(policies); | 267 (*handler)->PrepareForDisplaying(policies); |
268 } | 268 } |
269 | 269 |
270 } // namespace policy | 270 } // namespace policy |
OLD | NEW |