| 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/chromeos/user_cros_settings_provider.h" | 5 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 bool IsControlledListSetting(const std::string& pref_path) { | 71 bool IsControlledListSetting(const std::string& pref_path) { |
| 72 return std::find(kListSettings, | 72 return std::find(kListSettings, |
| 73 kListSettings + arraysize(kListSettings), | 73 kListSettings + arraysize(kListSettings), |
| 74 pref_path) != | 74 pref_path) != |
| 75 kListSettings + arraysize(kListSettings); | 75 kListSettings + arraysize(kListSettings); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void RegisterSetting(PrefService* local_state, const std::string& pref_path) { | 78 void RegisterSetting(PrefService* local_state, const std::string& pref_path) { |
| 79 local_state->RegisterBooleanPref((pref_path + kTrustedSuffix).c_str(), | 79 local_state->RegisterBooleanPref((pref_path + kTrustedSuffix).c_str(), |
| 80 false); | 80 false, |
| 81 PrefService::UNSYNCABLE_PREF); |
| 81 if (IsControlledBooleanSetting(pref_path)) { | 82 if (IsControlledBooleanSetting(pref_path)) { |
| 82 if (pref_path == kSignedDataRoamingEnabled) | 83 if (pref_path == kSignedDataRoamingEnabled) |
| 83 local_state->RegisterBooleanPref(pref_path.c_str(), false); | 84 local_state->RegisterBooleanPref(pref_path.c_str(), |
| 85 false, |
| 86 PrefService::UNSYNCABLE_PREF); |
| 84 else | 87 else |
| 85 local_state->RegisterBooleanPref(pref_path.c_str(), true); | 88 local_state->RegisterBooleanPref(pref_path.c_str(), |
| 89 true, |
| 90 PrefService::UNSYNCABLE_PREF); |
| 86 } else if (IsControlledStringSetting(pref_path)) { | 91 } else if (IsControlledStringSetting(pref_path)) { |
| 87 local_state->RegisterStringPref(pref_path.c_str(), ""); | 92 local_state->RegisterStringPref(pref_path.c_str(), |
| 93 "", |
| 94 PrefService::UNSYNCABLE_PREF); |
| 88 } else { | 95 } else { |
| 89 DCHECK(IsControlledListSetting(pref_path)); | 96 DCHECK(IsControlledListSetting(pref_path)); |
| 90 local_state->RegisterListPref(pref_path.c_str()); | 97 local_state->RegisterListPref(pref_path.c_str(), |
| 98 PrefService::UNSYNCABLE_PREF); |
| 91 } | 99 } |
| 92 } | 100 } |
| 93 | 101 |
| 94 // Create a settings boolean value with "managed" and "disabled" property. | 102 // Create a settings boolean value with "managed" and "disabled" property. |
| 95 // "managed" property is true if the setting is managed by administrator. | 103 // "managed" property is true if the setting is managed by administrator. |
| 96 // "disabled" property is true if the UI for the setting should be disabled. | 104 // "disabled" property is true if the UI for the setting should be disabled. |
| 97 Value* CreateSettingsBooleanValue(bool value, bool managed, bool disabled) { | 105 Value* CreateSettingsBooleanValue(bool value, bool managed, bool disabled) { |
| 98 DictionaryValue* dict = new DictionaryValue; | 106 DictionaryValue* dict = new DictionaryValue; |
| 99 dict->Set("value", Value::CreateBooleanValue(value)); | 107 dict->Set("value", Value::CreateBooleanValue(value)); |
| 100 dict->Set("managed", Value::CreateBooleanValue(managed)); | 108 dict->Set("managed", Value::CreateBooleanValue(managed)); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 if (cached_whitelist_update->Remove(email_value) != -1) | 601 if (cached_whitelist_update->Remove(email_value) != -1) |
| 594 prefs->ScheduleSavePersistentPrefs(); | 602 prefs->ScheduleSavePersistentPrefs(); |
| 595 } | 603 } |
| 596 | 604 |
| 597 // static | 605 // static |
| 598 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { | 606 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { |
| 599 UpdateCacheString(kDeviceOwner, email, USE_VALUE_SUPPLIED); | 607 UpdateCacheString(kDeviceOwner, email, USE_VALUE_SUPPLIED); |
| 600 } | 608 } |
| 601 | 609 |
| 602 } // namespace chromeos | 610 } // namespace chromeos |
| OLD | NEW |