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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 hardware_keyboard_id = | 66 hardware_keyboard_id = |
67 manager->GetInputMethodUtil()->GetHardwareInputMethodId(); | 67 manager->GetInputMethodUtil()->GetHardwareInputMethodId(); |
68 } else { | 68 } else { |
69 hardware_keyboard_id = "xkb:us::eng"; // only for testing. | 69 hardware_keyboard_id = "xkb:us::eng"; // only for testing. |
70 } | 70 } |
71 | 71 |
72 const bool enable_tap_to_click_default = IsLumpy(); | 72 const bool enable_tap_to_click_default = IsLumpy(); |
73 prefs->RegisterBooleanPref(prefs::kTapToClickEnabled, | 73 prefs->RegisterBooleanPref(prefs::kTapToClickEnabled, |
74 enable_tap_to_click_default, | 74 enable_tap_to_click_default, |
75 PrefService::SYNCABLE_PREF); | 75 PrefService::SYNCABLE_PREF); |
| 76 prefs->RegisterBooleanPref(prefs::kEnableTouchpadThreeFingerClick, |
| 77 false, |
| 78 PrefService::UNSYNCABLE_PREF); |
76 prefs->RegisterBooleanPref(prefs::kNaturalScroll, | 79 prefs->RegisterBooleanPref(prefs::kNaturalScroll, |
77 false, | 80 false, |
78 PrefService::SYNCABLE_PREF); | 81 PrefService::SYNCABLE_PREF); |
79 prefs->RegisterBooleanPref(prefs::kPrimaryMouseButtonRight, | 82 prefs->RegisterBooleanPref(prefs::kPrimaryMouseButtonRight, |
80 false, | 83 false, |
81 PrefService::SYNCABLE_PREF); | 84 PrefService::SYNCABLE_PREF); |
82 prefs->RegisterBooleanPref(prefs::kLabsMediaplayerEnabled, | 85 prefs->RegisterBooleanPref(prefs::kLabsMediaplayerEnabled, |
83 false, | 86 false, |
84 PrefService::UNSYNCABLE_PREF); | 87 PrefService::UNSYNCABLE_PREF); |
85 prefs->RegisterBooleanPref(prefs::kLabsAdvancedFilesystemEnabled, | 88 prefs->RegisterBooleanPref(prefs::kLabsAdvancedFilesystemEnabled, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 prefs->RegisterStringPref(prefs::kOAuth1Token, | 255 prefs->RegisterStringPref(prefs::kOAuth1Token, |
253 "", | 256 "", |
254 PrefService::UNSYNCABLE_PREF); | 257 PrefService::UNSYNCABLE_PREF); |
255 prefs->RegisterStringPref(prefs::kOAuth1Secret, | 258 prefs->RegisterStringPref(prefs::kOAuth1Secret, |
256 "", | 259 "", |
257 PrefService::UNSYNCABLE_PREF); | 260 PrefService::UNSYNCABLE_PREF); |
258 } | 261 } |
259 | 262 |
260 void Preferences::InitUserPrefs(PrefService* prefs) { | 263 void Preferences::InitUserPrefs(PrefService* prefs) { |
261 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); | 264 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); |
| 265 three_finger_click_enabled_.Init(prefs::kEnableTouchpadThreeFingerClick, |
| 266 prefs, this); |
262 natural_scroll_.Init(prefs::kNaturalScroll, prefs, this); | 267 natural_scroll_.Init(prefs::kNaturalScroll, prefs, this); |
263 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, prefs, this); | 268 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, prefs, this); |
264 mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, this); | 269 mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, this); |
265 touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); | 270 touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); |
266 use_24hour_clock_.Init(prefs::kUse24HourClock, prefs, this); | 271 use_24hour_clock_.Init(prefs::kUse24HourClock, prefs, this); |
267 disable_gdata_.Init(prefs::kDisableGData, prefs, this); | 272 disable_gdata_.Init(prefs::kDisableGData, prefs, this); |
268 disable_gdata_over_cellular_.Init(prefs::kDisableGDataOverCellular, | 273 disable_gdata_over_cellular_.Init(prefs::kDisableGDataOverCellular, |
269 prefs, this); | 274 prefs, this); |
270 disable_gdata_hosted_files_.Init(prefs::kDisableGDataHostedFiles, | 275 disable_gdata_hosted_files_.Init(prefs::kDisableGDataHostedFiles, |
271 prefs, this); | 276 prefs, this); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 370 |
366 void Preferences::NotifyPrefChanged(const std::string* pref_name) { | 371 void Preferences::NotifyPrefChanged(const std::string* pref_name) { |
367 if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { | 372 if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { |
368 const bool enabled = tap_to_click_enabled_.GetValue(); | 373 const bool enabled = tap_to_click_enabled_.GetValue(); |
369 system::touchpad_settings::SetTapToClick(enabled); | 374 system::touchpad_settings::SetTapToClick(enabled); |
370 if (pref_name) | 375 if (pref_name) |
371 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled); | 376 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled); |
372 else | 377 else |
373 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Started", enabled); | 378 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Started", enabled); |
374 } | 379 } |
| 380 if (!pref_name || *pref_name == prefs::kEnableTouchpadThreeFingerClick) { |
| 381 const bool enabled = three_finger_click_enabled_.GetValue(); |
| 382 system::touchpad_settings::SetThreeFingerClick(enabled); |
| 383 if (pref_name) |
| 384 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Changed", enabled); |
| 385 else |
| 386 UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerClick.Started", enabled); |
| 387 } |
375 if (!pref_name || *pref_name == prefs::kNaturalScroll) { | 388 if (!pref_name || *pref_name == prefs::kNaturalScroll) { |
376 const bool enabled = natural_scroll_.GetValue(); | 389 const bool enabled = natural_scroll_.GetValue(); |
377 ui::SetNaturalScroll(enabled); | 390 ui::SetNaturalScroll(enabled); |
378 if (pref_name) | 391 if (pref_name) |
379 UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Changed", enabled); | 392 UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Changed", enabled); |
380 else | 393 else |
381 UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Started", enabled); | 394 UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Started", enabled); |
382 } | 395 } |
383 if (!pref_name || *pref_name == prefs::kMouseSensitivity) { | 396 if (!pref_name || *pref_name == prefs::kMouseSensitivity) { |
384 const int sensitivity = mouse_sensitivity_.GetValue(); | 397 const int sensitivity = mouse_sensitivity_.GetValue(); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 710 |
698 // Remove invalid prefs. | 711 // Remove invalid prefs. |
699 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard); | 712 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard); |
700 DictionaryValue* pref_value = updater.Get(); | 713 DictionaryValue* pref_value = updater.Get(); |
701 for (size_t i = 0; i < layouts_to_remove.size(); ++i) { | 714 for (size_t i = 0; i < layouts_to_remove.size(); ++i) { |
702 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL); | 715 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL); |
703 } | 716 } |
704 } | 717 } |
705 | 718 |
706 } // namespace chromeos | 719 } // namespace chromeos |
OLD | NEW |