OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_pref_store.h" | 5 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 bool disable_sync; | 366 bool disable_sync; |
367 if (value->GetAsBoolean(&disable_sync) && disable_sync) | 367 if (value->GetAsBoolean(&disable_sync) && disable_sync) |
368 prefs_->Set(prefs::kSyncManaged, value); | 368 prefs_->Set(prefs::kSyncManaged, value); |
369 else | 369 else |
370 delete value; | 370 delete value; |
371 return true; | 371 return true; |
372 } | 372 } |
373 return false; | 373 return false; |
374 } | 374 } |
375 | 375 |
| 376 bool ConfigurationPolicyPrefStore::ApplyAutoFillPolicy(PolicyType policy, |
| 377 Value* value) { |
| 378 if (policy == ConfigurationPolicyStore::kPolicyAutoFillEnabled) { |
| 379 bool auto_fill_enabled; |
| 380 if (value->GetAsBoolean(&auto_fill_enabled) && !auto_fill_enabled) |
| 381 prefs_->Set(prefs::kAutoFillEnabled, Value::CreateBooleanValue(false)); |
| 382 delete value; |
| 383 return true; |
| 384 } |
| 385 return false; |
| 386 } |
| 387 |
376 bool ConfigurationPolicyPrefStore::ApplyPolicyFromMap(PolicyType policy, | 388 bool ConfigurationPolicyPrefStore::ApplyPolicyFromMap(PolicyType policy, |
377 Value* value, const PolicyToPreferenceMapEntry map[], int size) { | 389 Value* value, const PolicyToPreferenceMapEntry map[], int size) { |
378 const PolicyToPreferenceMapEntry* end = map + size; | 390 const PolicyToPreferenceMapEntry* end = map + size; |
379 for (const PolicyToPreferenceMapEntry* current = map; | 391 for (const PolicyToPreferenceMapEntry* current = map; |
380 current != end; ++current) { | 392 current != end; ++current) { |
381 if (current->policy_type == policy) { | 393 if (current->policy_type == policy) { |
382 DCHECK(current->value_type == value->GetType()); | 394 DCHECK(current->value_type == value->GetType()); |
383 prefs_->Set(current->preference_path, value); | 395 prefs_->Set(current->preference_path, value); |
384 return true; | 396 return true; |
385 } | 397 } |
386 } | 398 } |
387 return false; | 399 return false; |
388 } | 400 } |
389 | 401 |
390 void ConfigurationPolicyPrefStore::Apply(PolicyType policy, Value* value) { | 402 void ConfigurationPolicyPrefStore::Apply(PolicyType policy, Value* value) { |
391 if (ApplyProxyPolicy(policy, value)) | 403 if (ApplyProxyPolicy(policy, value)) |
392 return; | 404 return; |
393 | 405 |
394 if (ApplyPluginPolicy(policy, value)) | 406 if (ApplyPluginPolicy(policy, value)) |
395 return; | 407 return; |
396 | 408 |
397 if (ApplySyncPolicy(policy, value)) | 409 if (ApplySyncPolicy(policy, value)) |
398 return; | 410 return; |
399 | 411 |
| 412 if (ApplyAutoFillPolicy(policy, value)) |
| 413 return; |
| 414 |
400 if (ApplyPolicyFromMap(policy, value, simple_policy_map_, | 415 if (ApplyPolicyFromMap(policy, value, simple_policy_map_, |
401 arraysize(simple_policy_map_))) | 416 arraysize(simple_policy_map_))) |
402 return; | 417 return; |
403 | 418 |
404 // Other policy implementations go here. | 419 // Other policy implementations go here. |
405 NOTIMPLEMENTED(); | 420 NOTIMPLEMENTED(); |
406 delete value; | 421 delete value; |
407 } | 422 } |
OLD | NEW |