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 #include "chrome/browser/chromeos/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" |
6 | 6 |
7 #include "base/chromeos/chromeos_version.h" | 7 #include "base/chromeos/chromeos_version.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 Preferences::Preferences(input_method::InputMethodManager* input_method_manager) | 47 Preferences::Preferences(input_method::InputMethodManager* input_method_manager) |
48 : input_method_manager_(input_method_manager) { | 48 : input_method_manager_(input_method_manager) { |
49 } | 49 } |
50 | 50 |
51 Preferences::~Preferences() { | 51 Preferences::~Preferences() { |
52 prefs_->RemoveObserver(this); | 52 prefs_->RemoveObserver(this); |
53 } | 53 } |
54 | 54 |
55 // static | 55 // static |
56 void Preferences::RegisterUserPrefs(PrefService* prefs) { | 56 void Preferences::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
57 std::string hardware_keyboard_id; | 57 std::string hardware_keyboard_id; |
58 // TODO(yusukes): Remove the runtime hack. | 58 // TODO(yusukes): Remove the runtime hack. |
59 if (base::chromeos::IsRunningOnChromeOS()) { | 59 if (base::chromeos::IsRunningOnChromeOS()) { |
60 input_method::InputMethodManager* manager = | 60 input_method::InputMethodManager* manager = |
61 input_method::GetInputMethodManager(); | 61 input_method::GetInputMethodManager(); |
62 if (manager) { | 62 if (manager) { |
63 hardware_keyboard_id = | 63 hardware_keyboard_id = |
64 manager->GetInputMethodUtil()->GetHardwareInputMethodId(); | 64 manager->GetInputMethodUtil()->GetHardwareInputMethodId(); |
65 } | 65 } |
66 } else { | 66 } else { |
67 hardware_keyboard_id = "xkb:us::eng"; // only for testing. | 67 hardware_keyboard_id = "xkb:us::eng"; // only for testing. |
68 } | 68 } |
69 | 69 |
70 prefs->RegisterBooleanPref(prefs::kTapToClickEnabled, | 70 prefs->RegisterBooleanPref(prefs::kTapToClickEnabled, |
71 true, | 71 true, |
72 PrefService::SYNCABLE_PREF); | 72 PrefServiceSyncable::SYNCABLE_PREF); |
73 prefs->RegisterBooleanPref(prefs::kTapDraggingEnabled, | 73 prefs->RegisterBooleanPref(prefs::kTapDraggingEnabled, |
74 false, | 74 false, |
75 PrefService::SYNCABLE_PREF); | 75 PrefServiceSyncable::SYNCABLE_PREF); |
76 prefs->RegisterBooleanPref(prefs::kEnableTouchpadThreeFingerClick, | 76 prefs->RegisterBooleanPref(prefs::kEnableTouchpadThreeFingerClick, |
77 false, | 77 false, |
78 PrefService::UNSYNCABLE_PREF); | 78 PrefServiceSyncable::UNSYNCABLE_PREF); |
79 prefs->RegisterBooleanPref(prefs::kEnableTouchpadThreeFingerSwipe, | 79 prefs->RegisterBooleanPref(prefs::kEnableTouchpadThreeFingerSwipe, |
80 false, | 80 false, |
81 PrefService::UNSYNCABLE_PREF); | 81 PrefServiceSyncable::UNSYNCABLE_PREF); |
82 prefs->RegisterBooleanPref( | 82 prefs->RegisterBooleanPref( |
83 prefs::kNaturalScroll, | 83 prefs::kNaturalScroll, |
84 CommandLine::ForCurrentProcess()->HasSwitch( | 84 CommandLine::ForCurrentProcess()->HasSwitch( |
85 switches::kNaturalScrollDefault), | 85 switches::kNaturalScrollDefault), |
86 PrefService::SYNCABLE_PREF); | 86 PrefServiceSyncable::SYNCABLE_PREF); |
87 prefs->RegisterBooleanPref(prefs::kPrimaryMouseButtonRight, | 87 prefs->RegisterBooleanPref(prefs::kPrimaryMouseButtonRight, |
88 false, | 88 false, |
89 PrefService::SYNCABLE_PREF); | 89 PrefServiceSyncable::SYNCABLE_PREF); |
90 prefs->RegisterBooleanPref(prefs::kLabsMediaplayerEnabled, | 90 prefs->RegisterBooleanPref(prefs::kLabsMediaplayerEnabled, |
91 false, | 91 false, |
92 PrefService::UNSYNCABLE_PREF); | 92 PrefServiceSyncable::UNSYNCABLE_PREF); |
93 prefs->RegisterBooleanPref(prefs::kLabsAdvancedFilesystemEnabled, | 93 prefs->RegisterBooleanPref(prefs::kLabsAdvancedFilesystemEnabled, |
94 false, | 94 false, |
95 PrefService::UNSYNCABLE_PREF); | 95 PrefServiceSyncable::UNSYNCABLE_PREF); |
96 // Check if the accessibility pref is already registered, which can happen | 96 // Check if the accessibility pref is already registered, which can happen |
97 // in WizardController::RegisterPrefs. We still want to try to register | 97 // in WizardController::RegisterPrefs. We still want to try to register |
98 // the pref here in case of Chrome/Linux with ChromeOS=1. | 98 // the pref here in case of Chrome/Linux with ChromeOS=1. |
99 if (prefs->FindPreference(prefs::kSpokenFeedbackEnabled) == NULL) { | 99 if (prefs->FindPreference(prefs::kSpokenFeedbackEnabled) == NULL) { |
100 prefs->RegisterBooleanPref(prefs::kSpokenFeedbackEnabled, | 100 prefs->RegisterBooleanPref(prefs::kSpokenFeedbackEnabled, |
101 false, | 101 false, |
102 PrefService::UNSYNCABLE_PREF); | 102 PrefServiceSyncable::UNSYNCABLE_PREF); |
103 } | 103 } |
104 if (prefs->FindPreference(prefs::kHighContrastEnabled) == NULL) { | 104 if (prefs->FindPreference(prefs::kHighContrastEnabled) == NULL) { |
105 prefs->RegisterBooleanPref(prefs::kHighContrastEnabled, | 105 prefs->RegisterBooleanPref(prefs::kHighContrastEnabled, |
106 false, | 106 false, |
107 PrefService::UNSYNCABLE_PREF); | 107 PrefServiceSyncable::UNSYNCABLE_PREF); |
108 } | 108 } |
109 if (prefs->FindPreference(prefs::kScreenMagnifierEnabled) == NULL) { | 109 if (prefs->FindPreference(prefs::kScreenMagnifierEnabled) == NULL) { |
110 prefs->RegisterBooleanPref(prefs::kScreenMagnifierEnabled, | 110 prefs->RegisterBooleanPref(prefs::kScreenMagnifierEnabled, |
111 false, | 111 false, |
112 PrefService::SYNCABLE_PREF); | 112 PrefServiceSyncable::SYNCABLE_PREF); |
113 } | 113 } |
114 if (prefs->FindPreference(prefs::kScreenMagnifierScale) == NULL) { | 114 if (prefs->FindPreference(prefs::kScreenMagnifierScale) == NULL) { |
115 prefs->RegisterDoublePref(prefs::kScreenMagnifierScale, | 115 prefs->RegisterDoublePref(prefs::kScreenMagnifierScale, |
116 std::numeric_limits<double>::min(), | 116 std::numeric_limits<double>::min(), |
117 PrefService::UNSYNCABLE_PREF); | 117 PrefServiceSyncable::UNSYNCABLE_PREF); |
118 } | 118 } |
119 if (prefs->FindPreference(prefs::kShouldAlwaysShowAccessibilityMenu) == | 119 if (prefs->FindPreference(prefs::kShouldAlwaysShowAccessibilityMenu) == |
120 NULL) { | 120 NULL) { |
121 prefs->RegisterBooleanPref(prefs::kShouldAlwaysShowAccessibilityMenu, | 121 prefs->RegisterBooleanPref(prefs::kShouldAlwaysShowAccessibilityMenu, |
122 false, | 122 false, |
123 PrefService::UNSYNCABLE_PREF); | 123 PrefServiceSyncable::UNSYNCABLE_PREF); |
124 } | 124 } |
125 if (prefs->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) { | 125 if (prefs->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) { |
126 prefs->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, | 126 prefs->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, |
127 false, | 127 false, |
128 PrefService::UNSYNCABLE_PREF); | 128 PrefServiceSyncable::UNSYNCABLE_PREF); |
129 } | 129 } |
130 prefs->RegisterIntegerPref(prefs::kMouseSensitivity, | 130 prefs->RegisterIntegerPref(prefs::kMouseSensitivity, |
131 3, | 131 3, |
132 PrefService::SYNCABLE_PREF); | 132 PrefServiceSyncable::SYNCABLE_PREF); |
133 prefs->RegisterIntegerPref(prefs::kTouchpadSensitivity, | 133 prefs->RegisterIntegerPref(prefs::kTouchpadSensitivity, |
134 3, | 134 3, |
135 PrefService::SYNCABLE_PREF); | 135 PrefServiceSyncable::SYNCABLE_PREF); |
136 prefs->RegisterBooleanPref(prefs::kUse24HourClock, | 136 prefs->RegisterBooleanPref(prefs::kUse24HourClock, |
137 base::GetHourClockType() == base::k24HourClock, | 137 base::GetHourClockType() == base::k24HourClock, |
138 PrefService::SYNCABLE_PREF); | 138 PrefServiceSyncable::SYNCABLE_PREF); |
139 prefs->RegisterBooleanPref(prefs::kDisableDrive, | 139 prefs->RegisterBooleanPref(prefs::kDisableDrive, |
140 false, | 140 false, |
141 PrefService::SYNCABLE_PREF); | 141 PrefServiceSyncable::SYNCABLE_PREF); |
142 prefs->RegisterBooleanPref(prefs::kDisableDriveOverCellular, | 142 prefs->RegisterBooleanPref(prefs::kDisableDriveOverCellular, |
143 true, | 143 true, |
144 PrefService::SYNCABLE_PREF); | 144 PrefServiceSyncable::SYNCABLE_PREF); |
145 prefs->RegisterBooleanPref(prefs::kDisableDriveHostedFiles, | 145 prefs->RegisterBooleanPref(prefs::kDisableDriveHostedFiles, |
146 false, | 146 false, |
147 PrefService::SYNCABLE_PREF); | 147 PrefServiceSyncable::SYNCABLE_PREF); |
148 // We don't sync prefs::kLanguageCurrentInputMethod and PreviousInputMethod | 148 // We don't sync prefs::kLanguageCurrentInputMethod and PreviousInputMethod |
149 // because they're just used to track the logout state of the device. | 149 // because they're just used to track the logout state of the device. |
150 prefs->RegisterStringPref(prefs::kLanguageCurrentInputMethod, | 150 prefs->RegisterStringPref(prefs::kLanguageCurrentInputMethod, |
151 "", | 151 "", |
152 PrefService::UNSYNCABLE_PREF); | 152 PrefServiceSyncable::UNSYNCABLE_PREF); |
153 prefs->RegisterStringPref(prefs::kLanguagePreviousInputMethod, | 153 prefs->RegisterStringPref(prefs::kLanguagePreviousInputMethod, |
154 "", | 154 "", |
155 PrefService::UNSYNCABLE_PREF); | 155 PrefServiceSyncable::UNSYNCABLE_PREF); |
156 // We don't sync the list of input methods and preferred languages since a | 156 // We don't sync the list of input methods and preferred languages since a |
157 // user might use two or more devices with different hardware keyboards. | 157 // user might use two or more devices with different hardware keyboards. |
158 // crosbug.com/15181 | 158 // crosbug.com/15181 |
159 prefs->RegisterStringPref(prefs::kLanguagePreferredLanguages, | 159 prefs->RegisterStringPref(prefs::kLanguagePreferredLanguages, |
160 kFallbackInputMethodLocale, | 160 kFallbackInputMethodLocale, |
161 PrefService::UNSYNCABLE_PREF); | 161 PrefServiceSyncable::UNSYNCABLE_PREF); |
162 prefs->RegisterStringPref(prefs::kLanguagePreloadEngines, | 162 prefs->RegisterStringPref(prefs::kLanguagePreloadEngines, |
163 hardware_keyboard_id, | 163 hardware_keyboard_id, |
164 PrefService::UNSYNCABLE_PREF); | 164 PrefServiceSyncable::UNSYNCABLE_PREF); |
165 prefs->RegisterStringPref(prefs::kLanguageFilteredExtensionImes, | 165 prefs->RegisterStringPref(prefs::kLanguageFilteredExtensionImes, |
166 "", | 166 "", |
167 PrefService::UNSYNCABLE_PREF); | 167 PrefServiceSyncable::UNSYNCABLE_PREF); |
168 for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) { | 168 for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) { |
169 prefs->RegisterBooleanPref( | 169 prefs->RegisterBooleanPref( |
170 language_prefs::kChewingBooleanPrefs[i].pref_name, | 170 language_prefs::kChewingBooleanPrefs[i].pref_name, |
171 language_prefs::kChewingBooleanPrefs[i].default_pref_value, | 171 language_prefs::kChewingBooleanPrefs[i].default_pref_value, |
172 language_prefs::kChewingBooleanPrefs[i].sync_status); | 172 language_prefs::kChewingBooleanPrefs[i].sync_status); |
173 } | 173 } |
174 for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) { | 174 for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) { |
175 prefs->RegisterStringPref( | 175 prefs->RegisterStringPref( |
176 language_prefs::kChewingMultipleChoicePrefs[i].pref_name, | 176 language_prefs::kChewingMultipleChoicePrefs[i].pref_name, |
177 language_prefs::kChewingMultipleChoicePrefs[i].default_pref_value, | 177 language_prefs::kChewingMultipleChoicePrefs[i].default_pref_value, |
178 language_prefs::kChewingMultipleChoicePrefs[i].sync_status); | 178 language_prefs::kChewingMultipleChoicePrefs[i].sync_status); |
179 } | 179 } |
180 prefs->RegisterIntegerPref( | 180 prefs->RegisterIntegerPref( |
181 language_prefs::kChewingHsuSelKeyType.pref_name, | 181 language_prefs::kChewingHsuSelKeyType.pref_name, |
182 language_prefs::kChewingHsuSelKeyType.default_pref_value, | 182 language_prefs::kChewingHsuSelKeyType.default_pref_value, |
183 language_prefs::kChewingHsuSelKeyType.sync_status); | 183 language_prefs::kChewingHsuSelKeyType.sync_status); |
184 | 184 |
185 for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) { | 185 for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) { |
186 prefs->RegisterIntegerPref( | 186 prefs->RegisterIntegerPref( |
187 language_prefs::kChewingIntegerPrefs[i].pref_name, | 187 language_prefs::kChewingIntegerPrefs[i].pref_name, |
188 language_prefs::kChewingIntegerPrefs[i].default_pref_value, | 188 language_prefs::kChewingIntegerPrefs[i].default_pref_value, |
189 language_prefs::kChewingIntegerPrefs[i].sync_status); | 189 language_prefs::kChewingIntegerPrefs[i].sync_status); |
190 } | 190 } |
191 prefs->RegisterStringPref( | 191 prefs->RegisterStringPref( |
192 prefs::kLanguageHangulKeyboard, | 192 prefs::kLanguageHangulKeyboard, |
193 language_prefs::kHangulKeyboardNameIDPairs[0].keyboard_id, | 193 language_prefs::kHangulKeyboardNameIDPairs[0].keyboard_id, |
194 PrefService::SYNCABLE_PREF); | 194 PrefServiceSyncable::SYNCABLE_PREF); |
195 prefs->RegisterStringPref(prefs::kLanguageHangulHanjaBindingKeys, | 195 prefs->RegisterStringPref(prefs::kLanguageHangulHanjaBindingKeys, |
196 language_prefs::kHangulHanjaBindingKeys, | 196 language_prefs::kHangulHanjaBindingKeys, |
197 // Don't sync the pref as it's not user-configurable | 197 // Don't sync the pref as it's not user-configurable |
198 PrefService::UNSYNCABLE_PREF); | 198 PrefServiceSyncable::UNSYNCABLE_PREF); |
199 for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) { | 199 for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) { |
200 prefs->RegisterBooleanPref( | 200 prefs->RegisterBooleanPref( |
201 language_prefs::kPinyinBooleanPrefs[i].pref_name, | 201 language_prefs::kPinyinBooleanPrefs[i].pref_name, |
202 language_prefs::kPinyinBooleanPrefs[i].default_pref_value, | 202 language_prefs::kPinyinBooleanPrefs[i].default_pref_value, |
203 language_prefs::kPinyinBooleanPrefs[i].sync_status); | 203 language_prefs::kPinyinBooleanPrefs[i].sync_status); |
204 } | 204 } |
205 for (size_t i = 0; i < language_prefs::kNumPinyinIntegerPrefs; ++i) { | 205 for (size_t i = 0; i < language_prefs::kNumPinyinIntegerPrefs; ++i) { |
206 prefs->RegisterIntegerPref( | 206 prefs->RegisterIntegerPref( |
207 language_prefs::kPinyinIntegerPrefs[i].pref_name, | 207 language_prefs::kPinyinIntegerPrefs[i].pref_name, |
208 language_prefs::kPinyinIntegerPrefs[i].default_pref_value, | 208 language_prefs::kPinyinIntegerPrefs[i].default_pref_value, |
209 language_prefs::kPinyinIntegerPrefs[i].sync_status); | 209 language_prefs::kPinyinIntegerPrefs[i].sync_status); |
210 } | 210 } |
211 prefs->RegisterIntegerPref( | 211 prefs->RegisterIntegerPref( |
212 language_prefs::kPinyinDoublePinyinSchema.pref_name, | 212 language_prefs::kPinyinDoublePinyinSchema.pref_name, |
213 language_prefs::kPinyinDoublePinyinSchema.default_pref_value, | 213 language_prefs::kPinyinDoublePinyinSchema.default_pref_value, |
214 PrefService::UNSYNCABLE_PREF); | 214 PrefServiceSyncable::UNSYNCABLE_PREF); |
215 | 215 |
216 for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) { | 216 for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) { |
217 prefs->RegisterBooleanPref( | 217 prefs->RegisterBooleanPref( |
218 language_prefs::kMozcBooleanPrefs[i].pref_name, | 218 language_prefs::kMozcBooleanPrefs[i].pref_name, |
219 language_prefs::kMozcBooleanPrefs[i].default_pref_value, | 219 language_prefs::kMozcBooleanPrefs[i].default_pref_value, |
220 language_prefs::kMozcBooleanPrefs[i].sync_status); | 220 language_prefs::kMozcBooleanPrefs[i].sync_status); |
221 } | 221 } |
222 for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) { | 222 for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) { |
223 prefs->RegisterStringPref( | 223 prefs->RegisterStringPref( |
224 language_prefs::kMozcMultipleChoicePrefs[i].pref_name, | 224 language_prefs::kMozcMultipleChoicePrefs[i].pref_name, |
225 language_prefs::kMozcMultipleChoicePrefs[i].default_pref_value, | 225 language_prefs::kMozcMultipleChoicePrefs[i].default_pref_value, |
226 language_prefs::kMozcMultipleChoicePrefs[i].sync_status); | 226 language_prefs::kMozcMultipleChoicePrefs[i].sync_status); |
227 } | 227 } |
228 for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) { | 228 for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) { |
229 prefs->RegisterIntegerPref( | 229 prefs->RegisterIntegerPref( |
230 language_prefs::kMozcIntegerPrefs[i].pref_name, | 230 language_prefs::kMozcIntegerPrefs[i].pref_name, |
231 language_prefs::kMozcIntegerPrefs[i].default_pref_value, | 231 language_prefs::kMozcIntegerPrefs[i].default_pref_value, |
232 language_prefs::kMozcIntegerPrefs[i].sync_status); | 232 language_prefs::kMozcIntegerPrefs[i].sync_status); |
233 } | 233 } |
234 prefs->RegisterIntegerPref(prefs::kLanguageRemapSearchKeyTo, | 234 prefs->RegisterIntegerPref(prefs::kLanguageRemapSearchKeyTo, |
235 input_method::kSearchKey, | 235 input_method::kSearchKey, |
236 PrefService::SYNCABLE_PREF); | 236 PrefServiceSyncable::SYNCABLE_PREF); |
237 prefs->RegisterIntegerPref(prefs::kLanguageRemapControlKeyTo, | 237 prefs->RegisterIntegerPref(prefs::kLanguageRemapControlKeyTo, |
238 input_method::kControlKey, | 238 input_method::kControlKey, |
239 PrefService::SYNCABLE_PREF); | 239 PrefServiceSyncable::SYNCABLE_PREF); |
240 prefs->RegisterIntegerPref(prefs::kLanguageRemapAltKeyTo, | 240 prefs->RegisterIntegerPref(prefs::kLanguageRemapAltKeyTo, |
241 input_method::kAltKey, | 241 input_method::kAltKey, |
242 PrefService::SYNCABLE_PREF); | 242 PrefServiceSyncable::SYNCABLE_PREF); |
243 prefs->RegisterIntegerPref(prefs::kLanguageRemapCapsLockKeyTo, | 243 prefs->RegisterIntegerPref(prefs::kLanguageRemapCapsLockKeyTo, |
244 input_method::kCapsLockKey, | 244 input_method::kCapsLockKey, |
245 PrefService::SYNCABLE_PREF); | 245 PrefServiceSyncable::SYNCABLE_PREF); |
246 // We don't sync the following keyboard prefs since they are not user- | 246 // We don't sync the following keyboard prefs since they are not user- |
247 // configurable. | 247 // configurable. |
248 prefs->RegisterBooleanPref(prefs::kLanguageXkbAutoRepeatEnabled, | 248 prefs->RegisterBooleanPref(prefs::kLanguageXkbAutoRepeatEnabled, |
249 true, | 249 true, |
250 PrefService::UNSYNCABLE_PREF); | 250 PrefServiceSyncable::UNSYNCABLE_PREF); |
251 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatDelay, | 251 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatDelay, |
252 language_prefs::kXkbAutoRepeatDelayInMs, | 252 language_prefs::kXkbAutoRepeatDelayInMs, |
253 PrefService::UNSYNCABLE_PREF); | 253 PrefServiceSyncable::UNSYNCABLE_PREF); |
254 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatInterval, | 254 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatInterval, |
255 language_prefs::kXkbAutoRepeatIntervalInMs, | 255 language_prefs::kXkbAutoRepeatIntervalInMs, |
256 PrefService::UNSYNCABLE_PREF); | 256 PrefServiceSyncable::UNSYNCABLE_PREF); |
257 | 257 |
258 // Screen lock default to off. | 258 // Screen lock default to off. |
259 prefs->RegisterBooleanPref(prefs::kEnableScreenLock, | 259 prefs->RegisterBooleanPref(prefs::kEnableScreenLock, |
260 false, | 260 false, |
261 PrefService::SYNCABLE_PREF); | 261 PrefServiceSyncable::SYNCABLE_PREF); |
262 | 262 |
263 // Mobile plan notifications default to on. | 263 // Mobile plan notifications default to on. |
264 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, | 264 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, |
265 true, | 265 true, |
266 PrefService::SYNCABLE_PREF); | 266 PrefServiceSyncable::SYNCABLE_PREF); |
267 | 267 |
268 // 3G first-time usage promo will be shown at least once. | 268 // 3G first-time usage promo will be shown at least once. |
269 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification, | 269 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification, |
270 true, | 270 true, |
271 PrefService::UNSYNCABLE_PREF); | 271 PrefServiceSyncable::UNSYNCABLE_PREF); |
272 | 272 |
273 // Initially all existing users would see "What's new" | 273 // Initially all existing users would see "What's new" |
274 // for current version after update. | 274 // for current version after update. |
275 prefs->RegisterStringPref(prefs::kChromeOSReleaseNotesVersion, | 275 prefs->RegisterStringPref(prefs::kChromeOSReleaseNotesVersion, |
276 "0.0.0.0", | 276 "0.0.0.0", |
277 PrefService::SYNCABLE_PREF); | 277 PrefServiceSyncable::SYNCABLE_PREF); |
278 | 278 |
279 // OAuth1 all access token and secret pair. | 279 // OAuth1 all access token and secret pair. |
280 prefs->RegisterStringPref(prefs::kOAuth1Token, | 280 prefs->RegisterStringPref(prefs::kOAuth1Token, |
281 "", | 281 "", |
282 PrefService::UNSYNCABLE_PREF); | 282 PrefServiceSyncable::UNSYNCABLE_PREF); |
283 prefs->RegisterStringPref(prefs::kOAuth1Secret, | 283 prefs->RegisterStringPref(prefs::kOAuth1Secret, |
284 "", | 284 "", |
285 PrefService::UNSYNCABLE_PREF); | 285 PrefServiceSyncable::UNSYNCABLE_PREF); |
286 | 286 |
287 // TODO(wad): Once UI is connected, a final default can be set. At that point | 287 // TODO(wad): Once UI is connected, a final default can be set. At that point |
288 // change this pref from UNSYNCABLE to SYNCABLE. | 288 // change this pref from UNSYNCABLE to SYNCABLE. |
289 prefs->RegisterBooleanPref(prefs::kEnableCrosDRM, | 289 prefs->RegisterBooleanPref(prefs::kEnableCrosDRM, |
290 true, | 290 true, |
291 PrefService::UNSYNCABLE_PREF); | 291 PrefServiceSyncable::UNSYNCABLE_PREF); |
292 | 292 |
293 prefs->RegisterBooleanPref(prefs::kExternalStorageDisabled, | 293 prefs->RegisterBooleanPref(prefs::kExternalStorageDisabled, |
294 false, | 294 false, |
295 PrefService::UNSYNCABLE_PREF); | 295 PrefServiceSyncable::UNSYNCABLE_PREF); |
296 } | 296 } |
297 | 297 |
298 void Preferences::InitUserPrefs(PrefService* prefs) { | 298 void Preferences::InitUserPrefs(PrefServiceSyncable* prefs) { |
299 prefs_ = prefs; | 299 prefs_ = prefs; |
300 | 300 |
301 BooleanPrefMember::NamedChangeCallback callback = | 301 BooleanPrefMember::NamedChangeCallback callback = |
302 base::Bind(&Preferences::OnPreferenceChanged, base::Unretained(this)); | 302 base::Bind(&Preferences::OnPreferenceChanged, base::Unretained(this)); |
303 | 303 |
304 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, callback); | 304 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, callback); |
305 tap_dragging_enabled_.Init(prefs::kTapDraggingEnabled, prefs, callback); | 305 tap_dragging_enabled_.Init(prefs::kTapDraggingEnabled, prefs, callback); |
306 three_finger_click_enabled_.Init(prefs::kEnableTouchpadThreeFingerClick, | 306 three_finger_click_enabled_.Init(prefs::kEnableTouchpadThreeFingerClick, |
307 prefs, callback); | 307 prefs, callback); |
308 three_finger_swipe_enabled_.Init(prefs::kEnableTouchpadThreeFingerSwipe, | 308 three_finger_swipe_enabled_.Init(prefs::kEnableTouchpadThreeFingerSwipe, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 xkb_auto_repeat_delay_pref_.Init( | 379 xkb_auto_repeat_delay_pref_.Init( |
380 prefs::kLanguageXkbAutoRepeatDelay, prefs, callback); | 380 prefs::kLanguageXkbAutoRepeatDelay, prefs, callback); |
381 xkb_auto_repeat_interval_pref_.Init( | 381 xkb_auto_repeat_interval_pref_.Init( |
382 prefs::kLanguageXkbAutoRepeatInterval, prefs, callback); | 382 prefs::kLanguageXkbAutoRepeatInterval, prefs, callback); |
383 | 383 |
384 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, callback); | 384 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, callback); |
385 | 385 |
386 enable_drm_.Init(prefs::kEnableCrosDRM, prefs, callback); | 386 enable_drm_.Init(prefs::kEnableCrosDRM, prefs, callback); |
387 } | 387 } |
388 | 388 |
389 void Preferences::Init(PrefService* prefs) { | 389 void Preferences::Init(PrefServiceSyncable* prefs) { |
390 InitUserPrefs(prefs); | 390 InitUserPrefs(prefs); |
391 | 391 |
392 // This causes OnIsSyncingChanged to be called when the value of | 392 // This causes OnIsSyncingChanged to be called when the value of |
393 // PrefService::IsSyncing() changes. | 393 // PrefService::IsSyncing() changes. |
394 prefs->AddObserver(this); | 394 prefs->AddObserver(this); |
395 | 395 |
396 // Initialize preferences to currently saved state. | 396 // Initialize preferences to currently saved state. |
397 NotifyPrefChanged(NULL); | 397 NotifyPrefChanged(NULL); |
398 | 398 |
399 // If a guest is logged in, initialize the prefs as if this is the first | 399 // If a guest is logged in, initialize the prefs as if this is the first |
400 // login. | 400 // login. |
401 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { | 401 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { |
402 LoginUtils::Get()->SetFirstLoginPrefs(prefs); | 402 LoginUtils::Get()->SetFirstLoginPrefs(prefs); |
403 } | 403 } |
404 } | 404 } |
405 | 405 |
406 void Preferences::InitUserPrefsForTesting(PrefService* prefs) { | 406 void Preferences::InitUserPrefsForTesting(PrefServiceSyncable* prefs) { |
407 InitUserPrefs(prefs); | 407 InitUserPrefs(prefs); |
408 } | 408 } |
409 | 409 |
410 void Preferences::SetInputMethodListForTesting() { | 410 void Preferences::SetInputMethodListForTesting() { |
411 SetInputMethodList(); | 411 SetInputMethodList(); |
412 } | 412 } |
413 | 413 |
414 void Preferences::OnPreferenceChanged(const std::string& pref_name) { | 414 void Preferences::OnPreferenceChanged(const std::string& pref_name) { |
415 NotifyPrefChanged(&pref_name); | 415 NotifyPrefChanged(&pref_name); |
416 } | 416 } |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 | 784 |
785 input_method::AutoRepeatRate rate; | 785 input_method::AutoRepeatRate rate; |
786 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 786 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); |
787 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 787 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); |
788 DCHECK(rate.initial_delay_in_ms > 0); | 788 DCHECK(rate.initial_delay_in_ms > 0); |
789 DCHECK(rate.repeat_interval_in_ms > 0); | 789 DCHECK(rate.repeat_interval_in_ms > 0); |
790 input_method::XKeyboard::SetAutoRepeatRate(rate); | 790 input_method::XKeyboard::SetAutoRepeatRate(rate); |
791 } | 791 } |
792 | 792 |
793 } // namespace chromeos | 793 } // namespace chromeos |
OLD | NEW |