blob: b75d42e9515949a5e8d9c898f18eb43c028f012c [file] [log] [blame]
[email protected]487ba1462012-01-05 03:13:091// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]fecc1522009-10-15 21:08:292// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/chromeos/preferences.h"
6
[email protected]396991402014-02-17 10:56:177#include <vector>
8
[email protected]3c5ec44b2013-10-22 08:53:389#include "ash/autoclick/autoclick_controller.h"
[email protected]7585f4c2013-01-10 18:26:4110#include "ash/magnifier/magnifier_constants.h"
[email protected]d141b922013-07-09 08:13:1711#include "ash/shell.h"
[email protected]775caec2011-09-01 17:14:3212#include "base/command_line.h"
[email protected]530cd622011-04-14 15:45:0013#include "base/i18n/time_formatting.h"
[email protected]d7ca1ba2011-05-09 20:09:0814#include "base/metrics/histogram.h"
[email protected]1ab137b2013-03-21 03:33:1815#include "base/prefs/pref_member.h"
[email protected]681958c2013-02-21 13:48:1416#include "base/prefs/pref_registry_simple.h"
[email protected]9eec53fe2013-10-30 20:21:1717#include "base/prefs/scoped_user_pref_update.h"
[email protected]1988e1c2013-02-28 20:27:4218#include "base/strings/string_split.h"
[email protected]5c073322013-06-11 08:03:3019#include "base/strings/string_util.h"
[email protected]135cb802013-06-09 16:44:2020#include "base/strings/utf_string_conversions.h"
[email protected]49c4cf852013-09-27 19:28:2421#include "base/sys_info.h"
[email protected]c0a2128d92011-07-20 15:04:4622#include "chrome/browser/browser_process.h"
[email protected]fdf40f3e2013-07-11 23:55:4623#include "chrome/browser/chrome_notification_types.h"
[email protected]7585f4c2013-01-10 18:26:4124#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
[email protected]4fa2fd5d2013-04-26 03:42:5225#include "chrome/browser/chromeos/drive/file_system_util.h"
[email protected]9199bd52010-07-01 05:04:4126#include "chrome/browser/chromeos/input_method/input_method_util.h"
[email protected]295ca1a72014-07-01 16:14:3127#include "chrome/browser/chromeos/login/session/user_session_manager.h"
[email protected]f0881cf2014-08-15 23:31:4228#include "chrome/browser/chromeos/profiles/profile_helper.h"
[email protected]82eb8ec2011-12-20 22:24:3329#include "chrome/browser/chromeos/system/input_device_settings.h"
[email protected]b1d97272013-08-17 13:38:4930#include "chrome/browser/download/download_prefs.h"
[email protected]c753f142013-02-10 13:14:0431#include "chrome/browser/prefs/pref_service_syncable.h"
[email protected]775caec2011-09-01 17:14:3232#include "chrome/common/chrome_switches.h"
[email protected]fecc1522009-10-15 21:08:2933#include "chrome/common/pref_names.h"
[email protected]931d1042013-04-05 17:50:4434#include "chromeos/chromeos_switches.h"
[email protected]fdcd4412014-03-05 06:01:5835#include "chromeos/ime/extension_ime_util.h"
[email protected]fbb141a2014-04-11 13:25:5236#include "chromeos/ime/ime_keyboard.h"
[email protected]60049c02013-04-26 07:52:3637#include "chromeos/ime/input_method_manager.h"
[email protected]279690f82013-10-09 08:23:5238#include "chromeos/system/statistics_provider.h"
[email protected]1eab4e92014-05-09 02:17:1939#include "components/feedback/tracing_manager.h"
[email protected]f0c8c4992014-05-15 17:37:2640#include "components/pref_registry/pref_registry_syncable.h"
[email protected]2fda9972014-07-23 14:51:5941#include "components/user_manager/user.h"
[email protected]8bbf6192013-07-18 11:14:0442#include "third_party/icu/source/i18n/unicode/timezone.h"
[email protected]86ccbd42013-09-18 18:11:5443#include "ui/events/event_constants.h"
44#include "ui/events/event_utils.h"
[email protected]a6483d22013-07-03 22:11:0045#include "url/gurl.h"
[email protected]fecc1522009-10-15 21:08:2946
[email protected]de1528d1a2012-05-14 10:36:1547namespace chromeos {
[email protected]fecc1522009-10-15 21:08:2948
[email protected]9199bd52010-07-01 05:04:4149static const char kFallbackInputMethodLocale[] = "en-US";
[email protected]4793c942010-09-21 23:17:1750
[email protected]2c62b3f2012-04-12 12:07:5051Preferences::Preferences()
[email protected]155e1b42012-07-14 03:06:0152 : prefs_(NULL),
[email protected]daf37cc2013-11-01 18:10:2653 input_method_manager_(input_method::InputMethodManager::Get()),
[email protected]aa003a52014-02-15 06:24:2354 user_(NULL),
55 user_is_primary_(false) {
[email protected]d141b922013-07-09 08:13:1756 // Do not observe shell, if there is no shell instance; e.g., in some unit
57 // tests.
58 if (ash::Shell::HasInstance())
59 ash::Shell::GetInstance()->AddShellObserver(this);
[email protected]2c62b3f2012-04-12 12:07:5060}
61
62Preferences::Preferences(input_method::InputMethodManager* input_method_manager)
[email protected]eb5624e2013-05-23 19:50:2763 : prefs_(NULL),
[email protected]daf37cc2013-11-01 18:10:2664 input_method_manager_(input_method_manager),
[email protected]50de64ea2014-02-19 06:25:5065 user_(NULL),
66 user_is_primary_(false) {
[email protected]d141b922013-07-09 08:13:1767 // Do not observe shell, if there is no shell instance; e.g., in some unit
68 // tests.
69 if (ash::Shell::HasInstance())
70 ash::Shell::GetInstance()->AddShellObserver(this);
[email protected]2c62b3f2012-04-12 12:07:5071}
[email protected]d743a5982010-11-08 17:54:0972
[email protected]7f914fd2012-12-20 23:55:2573Preferences::~Preferences() {
74 prefs_->RemoveObserver(this);
[email protected]4d390782014-08-15 09:22:5875 user_manager::UserManager::Get()->RemoveSessionStateObserver(this);
[email protected]d141b922013-07-09 08:13:1776 // If shell instance is destoryed before this preferences instance, there is
77 // no need to remove this shell observer.
78 if (ash::Shell::HasInstance())
79 ash::Shell::GetInstance()->RemoveShellObserver(this);
[email protected]7f914fd2012-12-20 23:55:2580}
[email protected]9199bd52010-07-01 05:04:4181
[email protected]fecc1522009-10-15 21:08:2982// static
[email protected]681958c2013-02-21 13:48:1483void Preferences::RegisterPrefs(PrefRegistrySimple* registry) {
[email protected]681958c2013-02-21 13:48:1484 registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false);
85 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true);
[email protected]ced247a2014-06-13 19:14:1986 registry->RegisterBooleanPref(prefs::kAccessibilityVirtualKeyboardEnabled,
87 false);
[email protected]b01b9e22014-06-03 22:20:1988 registry->RegisterStringPref(prefs::kLogoutStartedLast, std::string());
[email protected]681958c2013-02-21 13:48:1489}
90
91// static
[email protected]37ca3fe02013-07-05 15:32:4492void Preferences::RegisterProfilePrefs(
[email protected]443e9312013-05-06 06:17:3493 user_prefs::PrefRegistrySyncable* registry) {
[email protected]2c62b3f2012-04-12 12:07:5094 std::string hardware_keyboard_id;
95 // TODO(yusukes): Remove the runtime hack.
[email protected]49c4cf852013-09-27 19:28:2496 if (base::SysInfo::IsRunningOnChromeOS()) {
[email protected]396991402014-02-17 10:56:1797 DCHECK(g_browser_process);
98 PrefService* local_state = g_browser_process->local_state();
99 DCHECK(local_state);
100 hardware_keyboard_id =
101 local_state->GetString(prefs::kHardwareKeyboardLayout);
[email protected]2c62b3f2012-04-12 12:07:50102 } else {
103 hardware_keyboard_id = "xkb:us::eng"; // only for testing.
104 }
[email protected]a9a81812011-09-16 11:01:17105
[email protected]443e9312013-05-06 06:17:34106 registry->RegisterBooleanPref(
[email protected]a1ea1292013-08-07 23:50:40107 prefs::kPerformanceTracingEnabled,
108 false,
109 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
110
111 registry->RegisterBooleanPref(
[email protected]443e9312013-05-06 06:17:34112 prefs::kTapToClickEnabled,
113 true,
[email protected]0e1aef1b2013-08-07 00:49:35114 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
[email protected]443e9312013-05-06 06:17:34115 registry->RegisterBooleanPref(
116 prefs::kTapDraggingEnabled,
117 false,
[email protected]0e1aef1b2013-08-07 00:49:35118 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
[email protected]443e9312013-05-06 06:17:34119 registry->RegisterBooleanPref(
120 prefs::kEnableTouchpadThreeFingerClick,
121 false,
122 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
123 registry->RegisterBooleanPref(
[email protected]61008732012-11-27 10:36:05124 prefs::kNaturalScroll,
[email protected]bbd08262013-10-30 09:04:27125 CommandLine::ForCurrentProcess()->HasSwitch(
126 switches::kNaturalScrollDefault),
[email protected]0e1aef1b2013-08-07 00:49:35127 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
[email protected]443e9312013-05-06 06:17:34128 registry->RegisterBooleanPref(
129 prefs::kPrimaryMouseButtonRight,
130 false,
[email protected]0e1aef1b2013-08-07 00:49:35131 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
[email protected]443e9312013-05-06 06:17:34132 registry->RegisterBooleanPref(
133 prefs::kLabsMediaplayerEnabled,
134 false,
135 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
136 registry->RegisterBooleanPref(
137 prefs::kLabsAdvancedFilesystemEnabled,
138 false,
139 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
140 registry->RegisterBooleanPref(
[email protected]ced247a2014-06-13 19:14:19141 prefs::kAccessibilityStickyKeysEnabled,
[email protected]3206f5f2013-06-12 18:13:06142 false,
[email protected]52560862013-09-23 04:24:56143 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]3206f5f2013-06-12 18:13:06144 registry->RegisterBooleanPref(
[email protected]ced247a2014-06-13 19:14:19145 prefs::kAccessibilityLargeCursorEnabled,
[email protected]8126b812013-06-06 03:49:17146 false,
147 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
148 registry->RegisterBooleanPref(
[email protected]ced247a2014-06-13 19:14:19149 prefs::kAccessibilitySpokenFeedbackEnabled,
[email protected]1dfebfc2013-06-04 03:14:32150 false,
[email protected]58983d42013-08-16 13:16:23151 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]1dfebfc2013-06-04 03:14:32152 registry->RegisterBooleanPref(
[email protected]ced247a2014-06-13 19:14:19153 prefs::kAccessibilityHighContrastEnabled,
[email protected]1dfebfc2013-06-04 03:14:32154 false,
[email protected]52560862013-09-23 04:24:56155 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]1dfebfc2013-06-04 03:14:32156 registry->RegisterBooleanPref(
[email protected]ced247a2014-06-13 19:14:19157 prefs::kAccessibilityScreenMagnifierEnabled,
[email protected]443e9312013-05-06 06:17:34158 false,
[email protected]52560862013-09-23 04:24:56159 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]443e9312013-05-06 06:17:34160 registry->RegisterIntegerPref(
[email protected]ced247a2014-06-13 19:14:19161 prefs::kAccessibilityScreenMagnifierType,
[email protected]443e9312013-05-06 06:17:34162 ash::kDefaultMagnifierType,
[email protected]52560862013-09-23 04:24:56163 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]443e9312013-05-06 06:17:34164 registry->RegisterDoublePref(
[email protected]ced247a2014-06-13 19:14:19165 prefs::kAccessibilityScreenMagnifierScale,
[email protected]443e9312013-05-06 06:17:34166 std::numeric_limits<double>::min(),
167 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
168 registry->RegisterBooleanPref(
[email protected]ced247a2014-06-13 19:14:19169 prefs::kAccessibilityAutoclickEnabled,
[email protected]1c881562013-10-12 07:52:58170 false,
171 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]3c5ec44b2013-10-22 08:53:38172 registry->RegisterIntegerPref(
[email protected]ced247a2014-06-13 19:14:19173 prefs::kAccessibilityAutoclickDelayMs,
[email protected]3c5ec44b2013-10-22 08:53:38174 ash::AutoclickController::kDefaultAutoclickDelayMs,
175 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]1c881562013-10-12 07:52:58176 registry->RegisterBooleanPref(
[email protected]ced247a2014-06-13 19:14:19177 prefs::kAccessibilityVirtualKeyboardEnabled,
178 false,
179 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]e1b299b2014-01-29 23:53:41180 registry->RegisterBooleanPref(
[email protected]443e9312013-05-06 06:17:34181 prefs::kShouldAlwaysShowAccessibilityMenu,
182 false,
[email protected]52560862013-09-23 04:24:56183 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]443e9312013-05-06 06:17:34184 registry->RegisterIntegerPref(
185 prefs::kMouseSensitivity,
186 3,
[email protected]0e1aef1b2013-08-07 00:49:35187 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
[email protected]443e9312013-05-06 06:17:34188 registry->RegisterIntegerPref(
189 prefs::kTouchpadSensitivity,
190 3,
[email protected]0e1aef1b2013-08-07 00:49:35191 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
[email protected]443e9312013-05-06 06:17:34192 registry->RegisterBooleanPref(
193 prefs::kUse24HourClock,
194 base::GetHourClockType() == base::k24HourClock,
195 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
196 registry->RegisterBooleanPref(
197 prefs::kDisableDrive,
198 false,
199 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
200 registry->RegisterBooleanPref(
201 prefs::kDisableDriveOverCellular,
202 true,
203 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
204 registry->RegisterBooleanPref(
205 prefs::kDisableDriveHostedFiles,
206 false,
207 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]aa96e372011-05-16 06:23:10208 // We don't sync prefs::kLanguageCurrentInputMethod and PreviousInputMethod
209 // because they're just used to track the logout state of the device.
[email protected]443e9312013-05-06 06:17:34210 registry->RegisterStringPref(
211 prefs::kLanguageCurrentInputMethod,
212 "",
213 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
214 registry->RegisterStringPref(
215 prefs::kLanguagePreviousInputMethod,
216 "",
217 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]aa96e372011-05-16 06:23:10218 // We don't sync the list of input methods and preferred languages since a
219 // user might use two or more devices with different hardware keyboards.
220 // crosbug.com/15181
[email protected]443e9312013-05-06 06:17:34221 registry->RegisterStringPref(
222 prefs::kLanguagePreferredLanguages,
223 kFallbackInputMethodLocale,
224 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
225 registry->RegisterStringPref(
226 prefs::kLanguagePreloadEngines,
227 hardware_keyboard_id,
228 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
229 registry->RegisterStringPref(
[email protected]aef1af4b12013-05-09 04:50:23230 prefs::kLanguageEnabledExtensionImes,
[email protected]443e9312013-05-06 06:17:34231 "",
232 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]7ac5af92010-06-07 01:25:44233
[email protected]443e9312013-05-06 06:17:34234 registry->RegisterIntegerPref(
235 prefs::kLanguageRemapSearchKeyTo,
236 input_method::kSearchKey,
[email protected]0e1aef1b2013-08-07 00:49:35237 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
[email protected]443e9312013-05-06 06:17:34238 registry->RegisterIntegerPref(
239 prefs::kLanguageRemapControlKeyTo,
240 input_method::kControlKey,
[email protected]0e1aef1b2013-08-07 00:49:35241 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
[email protected]443e9312013-05-06 06:17:34242 registry->RegisterIntegerPref(
243 prefs::kLanguageRemapAltKeyTo,
244 input_method::kAltKey,
[email protected]0e1aef1b2013-08-07 00:49:35245 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
[email protected]0f424fd92013-05-08 21:12:19246 // We don't sync the CapsLock remapping pref, since the UI hides this pref
247 // on certain devices, so syncing a non-default value to a device that
248 // doesn't allow changing the pref would be odd. http://crbug.com/167237
[email protected]443e9312013-05-06 06:17:34249 registry->RegisterIntegerPref(
250 prefs::kLanguageRemapCapsLockKeyTo,
251 input_method::kCapsLockKey,
[email protected]0f424fd92013-05-08 21:12:19252 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]443e9312013-05-06 06:17:34253 registry->RegisterIntegerPref(
254 prefs::kLanguageRemapDiamondKeyTo,
255 input_method::kControlKey,
[email protected]0e1aef1b2013-08-07 00:49:35256 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
[email protected]e2204a702013-10-29 21:58:54257 // The following pref isn't synced since the user may desire a different value
258 // depending on whether an external keyboard is attached to a particular
259 // device.
260 registry->RegisterBooleanPref(
261 prefs::kLanguageSendFunctionKeys,
262 false,
263 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]443e9312013-05-06 06:17:34264 registry->RegisterBooleanPref(
265 prefs::kLanguageXkbAutoRepeatEnabled,
266 true,
[email protected]08e672652014-07-25 01:24:14267 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]443e9312013-05-06 06:17:34268 registry->RegisterIntegerPref(
269 prefs::kLanguageXkbAutoRepeatDelay,
270 language_prefs::kXkbAutoRepeatDelayInMs,
[email protected]08e672652014-07-25 01:24:14271 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]443e9312013-05-06 06:17:34272 registry->RegisterIntegerPref(
273 prefs::kLanguageXkbAutoRepeatInterval,
274 language_prefs::kXkbAutoRepeatIntervalInMs,
[email protected]08e672652014-07-25 01:24:14275 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]4ccc05e2010-10-06 19:32:15276
[email protected]ea1eba52010-11-23 18:05:38277 // Mobile plan notifications default to on.
[email protected]443e9312013-05-06 06:17:34278 registry->RegisterBooleanPref(
279 prefs::kShowPlanNotifications,
280 true,
281 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]c74fffa2011-04-27 13:32:24282
283 // 3G first-time usage promo will be shown at least once.
[email protected]443e9312013-05-06 06:17:34284 registry->RegisterBooleanPref(
285 prefs::kShow3gPromoNotification,
286 true,
287 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]d6ae9502011-05-05 18:23:09288
[email protected]443e9312013-05-06 06:17:34289 // Initially all existing users would see "What's new" for current version
290 // after update.
[email protected]c753f142013-02-10 13:14:04291 registry->RegisterStringPref(prefs::kChromeOSReleaseNotesVersion,
292 "0.0.0.0",
[email protected]443e9312013-05-06 06:17:34293 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
[email protected]efb770c2012-05-04 22:31:48294
[email protected]443e9312013-05-06 06:17:34295 registry->RegisterBooleanPref(
296 prefs::kExternalStorageDisabled,
297 false,
298 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]3a229f42013-02-07 03:09:26299
[email protected]443e9312013-05-06 06:17:34300 registry->RegisterStringPref(
301 prefs::kTermsOfServiceURL,
302 "",
303 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]fddc44fe2013-07-04 00:03:51304
[email protected]d141b922013-07-09 08:13:17305 registry->RegisterBooleanPref(
306 prefs::kTouchHudProjectionEnabled,
307 false,
308 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]7a226972014-06-19 11:12:43309
310 registry->RegisterBooleanPref(
311 prefs::kTouchVirtualKeyboardEnabled,
312 false,
313 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
[email protected]fecc1522009-10-15 21:08:29314}
315
[email protected]5b199522012-12-22 17:24:44316void Preferences::InitUserPrefs(PrefServiceSyncable* prefs) {
[email protected]155e1b42012-07-14 03:06:01317 prefs_ = prefs;
318
[email protected]e7bff3e2012-11-14 15:34:44319 BooleanPrefMember::NamedChangeCallback callback =
320 base::Bind(&Preferences::OnPreferenceChanged, base::Unretained(this));
321
[email protected]a1ea1292013-08-07 23:50:40322 performance_tracing_enabled_.Init(prefs::kPerformanceTracingEnabled,
323 prefs, callback);
[email protected]e7bff3e2012-11-14 15:34:44324 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, callback);
325 tap_dragging_enabled_.Init(prefs::kTapDraggingEnabled, prefs, callback);
[email protected]190349fd2012-05-02 00:10:47326 three_finger_click_enabled_.Init(prefs::kEnableTouchpadThreeFingerClick,
[email protected]e7bff3e2012-11-14 15:34:44327 prefs, callback);
[email protected]e7bff3e2012-11-14 15:34:44328 natural_scroll_.Init(prefs::kNaturalScroll, prefs, callback);
[email protected]e7bff3e2012-11-14 15:34:44329 mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, callback);
330 touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, callback);
[email protected]aa003a52014-02-15 06:24:23331 primary_mouse_button_right_.Init(prefs::kPrimaryMouseButtonRight,
[email protected]e7bff3e2012-11-14 15:34:44332 prefs, callback);
[email protected]78a6b642012-09-12 02:07:03333 download_default_directory_.Init(prefs::kDownloadDefaultDirectory,
[email protected]e7bff3e2012-11-14 15:34:44334 prefs, callback);
[email protected]d141b922013-07-09 08:13:17335 touch_hud_projection_enabled_.Init(prefs::kTouchHudProjectionEnabled,
336 prefs, callback);
[email protected]e7bff3e2012-11-14 15:34:44337 preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, callback);
[email protected]aef1af4b12013-05-09 04:50:23338 enabled_extension_imes_.Init(prefs::kLanguageEnabledExtensionImes,
339 prefs, callback);
[email protected]e7bff3e2012-11-14 15:34:44340 current_input_method_.Init(prefs::kLanguageCurrentInputMethod,
341 prefs, callback);
342 previous_input_method_.Init(prefs::kLanguagePreviousInputMethod,
343 prefs, callback);
[email protected]22bec1a2012-03-27 06:33:48344
[email protected]c67a30932012-03-14 05:23:00345 xkb_auto_repeat_enabled_.Init(
[email protected]e7bff3e2012-11-14 15:34:44346 prefs::kLanguageXkbAutoRepeatEnabled, prefs, callback);
[email protected]c67a30932012-03-14 05:23:00347 xkb_auto_repeat_delay_pref_.Init(
[email protected]e7bff3e2012-11-14 15:34:44348 prefs::kLanguageXkbAutoRepeatDelay, prefs, callback);
[email protected]c67a30932012-03-14 05:23:00349 xkb_auto_repeat_interval_pref_.Init(
[email protected]e7bff3e2012-11-14 15:34:44350 prefs::kLanguageXkbAutoRepeatInterval, prefs, callback);
[email protected]2c62b3f2012-04-12 12:07:50351}
352
[email protected]f0881cf2014-08-15 23:31:42353void Preferences::Init(Profile* profile, const user_manager::User* user) {
354 DCHECK(profile);
[email protected]aa003a52014-02-15 06:24:23355 DCHECK(user);
[email protected]f0881cf2014-08-15 23:31:42356 PrefServiceSyncable* prefs = PrefServiceSyncable::FromProfile(profile);
[email protected]aa003a52014-02-15 06:24:23357 user_ = user;
[email protected]4d390782014-08-15 09:22:58358 user_is_primary_ =
359 user_manager::UserManager::Get()->GetPrimaryUser() == user_;
[email protected]2c62b3f2012-04-12 12:07:50360 InitUserPrefs(prefs);
[email protected]4ccc05e2010-10-06 19:32:15361
[email protected]4d390782014-08-15 09:22:58362 user_manager::UserManager::Get()->AddSessionStateObserver(this);
[email protected]aa003a52014-02-15 06:24:23363
[email protected]7f914fd2012-12-20 23:55:25364 // This causes OnIsSyncingChanged to be called when the value of
365 // PrefService::IsSyncing() changes.
366 prefs->AddObserver(this);
367
[email protected]f0881cf2014-08-15 23:31:42368 UserSessionManager* session_manager = UserSessionManager::GetInstance();
369 DCHECK(session_manager);
alemate829e2bf2014-09-06 13:24:46370 ime_state_ = session_manager->GetDefaultIMEState(profile);
[email protected]f0881cf2014-08-15 23:31:42371 input_method_manager_->SetState(ime_state_);
372
[email protected]d7ca1ba2011-05-09 20:09:08373 // Initialize preferences to currently saved state.
[email protected]aa003a52014-02-15 06:24:23374 ApplyPreferences(REASON_INITIALIZATION, "");
[email protected]26012e22010-12-01 06:44:27375
376 // If a guest is logged in, initialize the prefs as if this is the first
[email protected]bb9c5d72014-06-14 19:21:21377 // login. For a regular user this is done in
[email protected]295ca1a72014-07-01 16:14:31378 // UserSessionManager::InitProfilePreferences().
[email protected]bb9c5d72014-06-14 19:21:21379 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession))
[email protected]f0881cf2014-08-15 23:31:42380 session_manager->SetFirstLoginPrefs(profile, std::string(), std::string());
[email protected]fecc1522009-10-15 21:08:29381}
382
[email protected]f0881cf2014-08-15 23:31:42383void Preferences::InitUserPrefsForTesting(
384 PrefServiceSyncable* prefs,
385 const user_manager::User* user,
386 scoped_refptr<input_method::InputMethodManager::State> ime_state) {
[email protected]aa003a52014-02-15 06:24:23387 user_ = user;
[email protected]f0881cf2014-08-15 23:31:42388 ime_state_ = ime_state;
389
dcheng4c384d92014-09-15 23:29:45390 if (ime_state.get())
[email protected]f0881cf2014-08-15 23:31:42391 input_method_manager_->SetState(ime_state);
392
[email protected]2c62b3f2012-04-12 12:07:50393 InitUserPrefs(prefs);
394}
395
396void Preferences::SetInputMethodListForTesting() {
397 SetInputMethodList();
398}
399
[email protected]e7bff3e2012-11-14 15:34:44400void Preferences::OnPreferenceChanged(const std::string& pref_name) {
[email protected]aa003a52014-02-15 06:24:23401 ApplyPreferences(REASON_PREF_CHANGED, pref_name);
[email protected]fecc1522009-10-15 21:08:29402}
403
[email protected]aa003a52014-02-15 06:24:23404void Preferences::ApplyPreferences(ApplyReason reason,
405 const std::string& pref_name) {
406 DCHECK(reason != REASON_PREF_CHANGED || !pref_name.empty());
407 const bool user_is_owner =
[email protected]4d390782014-08-15 09:22:58408 user_manager::UserManager::Get()->GetOwnerEmail() == user_->email();
[email protected]aa003a52014-02-15 06:24:23409 const bool user_is_active = user_->is_active();
410
[email protected]bd36e172014-02-14 19:49:57411 system::TouchpadSettings touchpad_settings;
412 system::MouseSettings mouse_settings;
[email protected]aa003a52014-02-15 06:24:23413
414 if (user_is_primary_ && (reason == REASON_INITIALIZATION ||
415 pref_name == prefs::kPerformanceTracingEnabled)) {
[email protected]a1ea1292013-08-07 23:50:40416 const bool enabled = performance_tracing_enabled_.GetValue();
417 if (enabled)
418 tracing_manager_ = TracingManager::Create();
419 else
420 tracing_manager_.reset();
421 }
[email protected]aa003a52014-02-15 06:24:23422 if (reason != REASON_PREF_CHANGED || pref_name == prefs::kTapToClickEnabled) {
[email protected]b685fbd2012-03-24 09:23:04423 const bool enabled = tap_to_click_enabled_.GetValue();
[email protected]aa003a52014-02-15 06:24:23424 if (user_is_active)
425 touchpad_settings.SetTapToClick(enabled);
426 if (reason == REASON_PREF_CHANGED)
[email protected]d7ca1ba2011-05-09 20:09:08427 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled);
[email protected]aa003a52014-02-15 06:24:23428 else if (reason == REASON_INITIALIZATION)
[email protected]d7ca1ba2011-05-09 20:09:08429 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Started", enabled);
[email protected]022c3b92012-09-13 19:45:59430
431 // Save owner preference in local state to use on login screen.
[email protected]aa003a52014-02-15 06:24:23432 if (user_is_owner) {
[email protected]022c3b92012-09-13 19:45:59433 PrefService* prefs = g_browser_process->local_state();
434 if (prefs->GetBoolean(prefs::kOwnerTapToClickEnabled) != enabled)
435 prefs->SetBoolean(prefs::kOwnerTapToClickEnabled, enabled);
436 }
[email protected]3b02de292010-05-13 06:05:05437 }
[email protected]aa003a52014-02-15 06:24:23438 if (reason != REASON_PREF_CHANGED ||
439 pref_name == prefs::kTapDraggingEnabled) {
[email protected]1b46af02012-10-31 05:23:54440 const bool enabled = tap_dragging_enabled_.GetValue();
[email protected]aa003a52014-02-15 06:24:23441 if (user_is_active)
442 touchpad_settings.SetTapDragging(enabled);
443 if (reason == REASON_PREF_CHANGED)
[email protected]1b46af02012-10-31 05:23:54444 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapDragging.Changed", enabled);
[email protected]aa003a52014-02-15 06:24:23445 else if (reason == REASON_INITIALIZATION)
[email protected]1b46af02012-10-31 05:23:54446 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapDragging.Started", enabled);
447 }
[email protected]aa003a52014-02-15 06:24:23448 if (reason != REASON_PREF_CHANGED ||
449 pref_name == prefs::kEnableTouchpadThreeFingerClick) {
[email protected]190349fd2012-05-02 00:10:47450 const bool enabled = three_finger_click_enabled_.GetValue();
[email protected]aa003a52014-02-15 06:24:23451 if (user_is_active)
452 touchpad_settings.SetThreeFingerClick(enabled);
453 if (reason == REASON_PREF_CHANGED)
[email protected]190349fd2012-05-02 00:10:47454 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Changed", enabled);
[email protected]aa003a52014-02-15 06:24:23455 else if (reason == REASON_INITIALIZATION)
[email protected]190349fd2012-05-02 00:10:47456 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Started", enabled);
457 }
[email protected]aa003a52014-02-15 06:24:23458 if (reason != REASON_PREF_CHANGED || pref_name == prefs::kNaturalScroll) {
[email protected]7f914fd2012-12-20 23:55:25459 // Force natural scroll default if we've sync'd and if the cmd line arg is
460 // set.
461 ForceNaturalScrollDefault();
[email protected]223059e2012-10-05 01:44:49462
[email protected]b685fbd2012-03-24 09:23:04463 const bool enabled = natural_scroll_.GetValue();
[email protected]223059e2012-10-05 01:44:49464 DVLOG(1) << "Natural scroll set to " << enabled;
[email protected]aa003a52014-02-15 06:24:23465 if (user_is_active)
[email protected]158775422014-04-03 18:15:59466 touchpad_settings.SetNaturalScroll(enabled);
[email protected]aa003a52014-02-15 06:24:23467 if (reason == REASON_PREF_CHANGED)
[email protected]b685fbd2012-03-24 09:23:04468 UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Changed", enabled);
[email protected]aa003a52014-02-15 06:24:23469 else if (reason == REASON_INITIALIZATION)
[email protected]b685fbd2012-03-24 09:23:04470 UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Started", enabled);
471 }
[email protected]aa003a52014-02-15 06:24:23472 if (reason != REASON_PREF_CHANGED || pref_name == prefs::kMouseSensitivity) {
[email protected]563fb5f2012-03-31 00:39:28473 const int sensitivity = mouse_sensitivity_.GetValue();
[email protected]aa003a52014-02-15 06:24:23474 if (user_is_active)
475 mouse_settings.SetSensitivity(sensitivity);
476 if (reason == REASON_PREF_CHANGED) {
[email protected]3a337d32013-07-02 05:14:24477 UMA_HISTOGRAM_ENUMERATION("Mouse.PointerSensitivity.Changed",
478 sensitivity,
479 system::kMaxPointerSensitivity + 1);
[email protected]aa003a52014-02-15 06:24:23480 } else if (reason == REASON_INITIALIZATION) {
[email protected]3a337d32013-07-02 05:14:24481 UMA_HISTOGRAM_ENUMERATION("Mouse.PointerSensitivity.Started",
482 sensitivity,
483 system::kMaxPointerSensitivity + 1);
[email protected]563fb5f2012-03-31 00:39:28484 }
485 }
[email protected]aa003a52014-02-15 06:24:23486 if (reason != REASON_PREF_CHANGED ||
487 pref_name == prefs::kTouchpadSensitivity) {
[email protected]563fb5f2012-03-31 00:39:28488 const int sensitivity = touchpad_sensitivity_.GetValue();
[email protected]aa003a52014-02-15 06:24:23489 if (user_is_active)
490 touchpad_settings.SetSensitivity(sensitivity);
491 if (reason == REASON_PREF_CHANGED) {
[email protected]3a337d32013-07-02 05:14:24492 UMA_HISTOGRAM_ENUMERATION("Touchpad.PointerSensitivity.Changed",
493 sensitivity,
494 system::kMaxPointerSensitivity + 1);
[email protected]aa003a52014-02-15 06:24:23495 } else if (reason == REASON_INITIALIZATION) {
[email protected]3a337d32013-07-02 05:14:24496 UMA_HISTOGRAM_ENUMERATION("Touchpad.PointerSensitivity.Started",
497 sensitivity,
498 system::kMaxPointerSensitivity + 1);
[email protected]d7ca1ba2011-05-09 20:09:08499 }
[email protected]3b02de292010-05-13 06:05:05500 }
[email protected]aa003a52014-02-15 06:24:23501 if (reason != REASON_PREF_CHANGED ||
502 pref_name == prefs::kPrimaryMouseButtonRight) {
[email protected]0027fde12011-12-15 05:09:38503 const bool right = primary_mouse_button_right_.GetValue();
[email protected]aa003a52014-02-15 06:24:23504 if (user_is_active)
505 mouse_settings.SetPrimaryButtonRight(right);
506 if (reason == REASON_PREF_CHANGED)
[email protected]6c8599e2012-01-20 04:31:58507 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right);
[email protected]aa003a52014-02-15 06:24:23508 else if (reason == REASON_INITIALIZATION)
[email protected]6c8599e2012-01-20 04:31:58509 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right);
[email protected]022c3b92012-09-13 19:45:59510 // Save owner preference in local state to use on login screen.
[email protected]aa003a52014-02-15 06:24:23511 if (user_is_owner) {
[email protected]022c3b92012-09-13 19:45:59512 PrefService* prefs = g_browser_process->local_state();
513 if (prefs->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight) != right)
514 prefs->SetBoolean(prefs::kOwnerPrimaryMouseButtonRight, right);
515 }
[email protected]0027fde12011-12-15 05:09:38516 }
[email protected]aa003a52014-02-15 06:24:23517 if (reason != REASON_PREF_CHANGED ||
518 pref_name == prefs::kDownloadDefaultDirectory) {
[email protected]d9d04df2012-10-12 07:06:35519 const bool default_download_to_drive = drive::util::IsUnderDriveMountPoint(
[email protected]78a6b642012-09-12 02:07:03520 download_default_directory_.GetValue());
[email protected]aa003a52014-02-15 06:24:23521 if (reason == REASON_PREF_CHANGED)
[email protected]e8307a12012-09-12 20:06:34522 UMA_HISTOGRAM_BOOLEAN(
523 "FileBrowser.DownloadDestination.IsGoogleDrive.Changed",
[email protected]78a6b642012-09-12 02:07:03524 default_download_to_drive);
[email protected]aa003a52014-02-15 06:24:23525 else if (reason == REASON_INITIALIZATION)
[email protected]e8307a12012-09-12 20:06:34526 UMA_HISTOGRAM_BOOLEAN(
527 "FileBrowser.DownloadDestination.IsGoogleDrive.Started",
[email protected]78a6b642012-09-12 02:07:03528 default_download_to_drive);
529 }
[email protected]aa003a52014-02-15 06:24:23530 if (reason != REASON_PREF_CHANGED ||
531 pref_name == prefs::kTouchHudProjectionEnabled) {
dpolukhin04e5b8092014-09-11 02:55:05532#if !defined(USE_ATHENA)
[email protected]aa003a52014-02-15 06:24:23533 if (user_is_active) {
534 const bool enabled = touch_hud_projection_enabled_.GetValue();
535 ash::Shell::GetInstance()->SetTouchHudProjectionEnabled(enabled);
536 }
dpolukhin04e5b8092014-09-11 02:55:05537#endif
[email protected]d141b922013-07-09 08:13:17538 }
[email protected]8be9ff22010-06-08 02:13:54539
[email protected]aa003a52014-02-15 06:24:23540 if (reason != REASON_PREF_CHANGED ||
541 pref_name == prefs::kLanguageXkbAutoRepeatEnabled) {
542 if (user_is_active) {
543 const bool enabled = xkb_auto_repeat_enabled_.GetValue();
[email protected]fbb141a2014-04-11 13:25:52544 input_method::InputMethodManager::Get()
545 ->GetImeKeyboard()
[email protected]aa003a52014-02-15 06:24:23546 ->SetAutoRepeatEnabled(enabled);
547 }
548 }
549 if (reason != REASON_PREF_CHANGED ||
550 pref_name == prefs::kLanguageXkbAutoRepeatDelay ||
551 pref_name == prefs::kLanguageXkbAutoRepeatInterval) {
552 if (user_is_active)
553 UpdateAutoRepeatRate();
[email protected]74b42fc12010-07-20 10:15:41554 }
[email protected]a6e90772011-02-09 05:38:54555
[email protected]f0881cf2014-08-15 23:31:42556 if (reason == REASON_INITIALIZATION)
[email protected]2c62b3f2012-04-12 12:07:50557 SetInputMethodList();
[email protected]f0881cf2014-08-15 23:31:42558
559 if (pref_name == prefs::kLanguagePreloadEngines &&
560 reason == REASON_PREF_CHANGED) {
[email protected]7f132d02013-01-03 00:32:26561 SetLanguageConfigStringListAsCSV(language_prefs::kGeneralSectionName,
562 language_prefs::kPreloadEnginesConfigName,
[email protected]c67a30932012-03-14 05:23:00563 preload_engines_.GetValue());
[email protected]3b02de292010-05-13 06:05:05564 }
[email protected]22bec1a2012-03-27 06:33:48565
[email protected]f0881cf2014-08-15 23:31:42566 if ((reason == REASON_INITIALIZATION) ||
567 (pref_name == prefs::kLanguageEnabledExtensionImes &&
568 reason == REASON_PREF_CHANGED)) {
569 std::string value(enabled_extension_imes_.GetValue());
[email protected]797c6802012-09-20 10:36:13570
[email protected]f0881cf2014-08-15 23:31:42571 std::vector<std::string> split_values;
572 if (!value.empty())
573 base::SplitString(value, ',', &split_values);
[email protected]797c6802012-09-20 10:36:13574
[email protected]f0881cf2014-08-15 23:31:42575 ime_state_->SetEnabledExtensionImes(&split_values);
[email protected]797c6802012-09-20 10:36:13576 }
[email protected]aa003a52014-02-15 06:24:23577
578 if (user_is_active) {
579 system::InputDeviceSettings::Get()->UpdateTouchpadSettings(
580 touchpad_settings);
581 system::InputDeviceSettings::Get()->UpdateMouseSettings(mouse_settings);
582 }
[email protected]fecc1522009-10-15 21:08:29583}
584
[email protected]7f914fd2012-12-20 23:55:25585void Preferences::OnIsSyncingChanged() {
586 DVLOG(1) << "OnIsSyncingChanged";
587 ForceNaturalScrollDefault();
588}
589
590void Preferences::ForceNaturalScrollDefault() {
591 DVLOG(1) << "ForceNaturalScrollDefault";
[email protected]bbd08262013-10-30 09:04:27592 if (CommandLine::ForCurrentProcess()->HasSwitch(
593 switches::kNaturalScrollDefault) &&
[email protected]7f914fd2012-12-20 23:55:25594 prefs_->IsSyncing() &&
595 !prefs_->GetUserPrefValue(prefs::kNaturalScroll)) {
596 DVLOG(1) << "Natural scroll forced to true";
597 natural_scroll_.SetValue(true);
598 UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Forced", true);
599 }
600}
601
[email protected]d01bb8072010-04-12 13:00:15602void Preferences::SetLanguageConfigStringListAsCSV(const char* section,
603 const char* name,
[email protected]ddd231e2010-06-29 20:35:19604 const std::string& value) {
[email protected]e24c2c92010-10-23 01:39:24605 VLOG(1) << "Setting " << name << " to '" << value << "'";
[email protected]d01bb8072010-04-12 13:00:15606
[email protected]ddd231e2010-06-29 20:35:19607 std::vector<std::string> split_values;
608 if (!value.empty())
[email protected]76eb0242010-10-14 00:35:36609 base::SplitString(value, ',', &split_values);
[email protected]ddd231e2010-06-29 20:35:19610
[email protected]b071452e2014-06-02 19:17:12611 // Transfers the xkb id to extension-xkb id.
612 if (input_method_manager_->MigrateInputMethods(&split_values))
[email protected]fdcd4412014-03-05 06:01:58613 preload_engines_.SetValue(JoinString(split_values, ','));
614
[email protected]7f132d02013-01-03 00:32:26615 if (section == std::string(language_prefs::kGeneralSectionName) &&
616 name == std::string(language_prefs::kPreloadEnginesConfigName)) {
[email protected]f0881cf2014-08-15 23:31:42617 ime_state_->ReplaceEnabledInputMethods(split_values);
[email protected]dbc9b192012-04-18 05:55:34618 return;
619 }
[email protected]70aa5b32010-04-05 08:30:34620}
621
[email protected]2c62b3f2012-04-12 12:07:50622void Preferences::SetInputMethodList() {
623 // When |preload_engines_| are set, InputMethodManager::ChangeInputMethod()
624 // might be called to change the current input method to the first one in the
625 // |preload_engines_| list. This also updates previous/current input method
626 // prefs. That's why GetValue() calls are placed before the
627 // SetLanguageConfigStringListAsCSV() call below.
628 const std::string previous_input_method_id =
629 previous_input_method_.GetValue();
630 const std::string current_input_method_id = current_input_method_.GetValue();
[email protected]7f132d02013-01-03 00:32:26631 SetLanguageConfigStringListAsCSV(language_prefs::kGeneralSectionName,
632 language_prefs::kPreloadEnginesConfigName,
[email protected]2c62b3f2012-04-12 12:07:50633 preload_engines_.GetValue());
634
635 // ChangeInputMethod() has to be called AFTER the value of |preload_engines_|
636 // is sent to the InputMethodManager. Otherwise, the ChangeInputMethod request
637 // might be ignored as an invalid input method ID. The ChangeInputMethod()
638 // calls are also necessary to restore the previous/current input method prefs
639 // which could have been modified by the SetLanguageConfigStringListAsCSV call
640 // above to the original state.
641 if (!previous_input_method_id.empty())
[email protected]f0881cf2014-08-15 23:31:42642 ime_state_->ChangeInputMethod(previous_input_method_id,
643 false /* show_message */);
[email protected]2c62b3f2012-04-12 12:07:50644 if (!current_input_method_id.empty())
[email protected]f0881cf2014-08-15 23:31:42645 ime_state_->ChangeInputMethod(current_input_method_id,
646 false /* show_message */);
[email protected]2c62b3f2012-04-12 12:07:50647}
648
[email protected]a995b392010-08-11 04:38:59649void Preferences::UpdateAutoRepeatRate() {
[email protected]c010f632011-04-01 06:44:39650 input_method::AutoRepeatRate rate;
[email protected]c67a30932012-03-14 05:23:00651 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue();
652 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue();
[email protected]a995b392010-08-11 04:38:59653 DCHECK(rate.initial_delay_in_ms > 0);
654 DCHECK(rate.repeat_interval_in_ms > 0);
[email protected]fbb141a2014-04-11 13:25:52655 input_method::InputMethodManager::Get()
656 ->GetImeKeyboard()
[email protected]b4d95fb2014-02-12 14:48:07657 ->SetAutoRepeatRate(rate);
[email protected]a995b392010-08-11 04:38:59658}
659
[email protected]d141b922013-07-09 08:13:17660void Preferences::OnTouchHudProjectionToggled(bool enabled) {
661 if (touch_hud_projection_enabled_.GetValue() == enabled)
662 return;
[email protected]aa003a52014-02-15 06:24:23663 if (!user_->is_active())
664 return;
[email protected]d141b922013-07-09 08:13:17665 touch_hud_projection_enabled_.SetValue(enabled);
666}
667
[email protected]2fda9972014-07-23 14:51:59668void Preferences::ActiveUserChanged(const user_manager::User* active_user) {
[email protected]aa003a52014-02-15 06:24:23669 if (active_user != user_)
670 return;
671 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, "");
672}
673
[email protected]fecc1522009-10-15 21:08:29674} // namespace chromeos