| 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 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 33 #include "content/public/browser/notification_details.h" | 33 #include "content/public/browser/notification_details.h" |
| 34 #include "content/public/browser/notification_source.h" | 34 #include "content/public/browser/notification_source.h" |
| 35 #include "googleurl/src/gurl.h" | 35 #include "googleurl/src/gurl.h" |
| 36 #include "ui/base/events/event_constants.h" | 36 #include "ui/base/events/event_constants.h" |
| 37 #include "unicode/timezone.h" | 37 #include "unicode/timezone.h" |
| 38 | 38 |
| 39 namespace chromeos { | 39 namespace chromeos { |
| 40 namespace { | |
| 41 | |
| 42 // TODO(achuith): Use a cmd-line flag + use flags for this instead. | |
| 43 bool IsLumpy() { | |
| 44 std::string board; | |
| 45 system::StatisticsProvider::GetInstance()->GetMachineStatistic( | |
| 46 "CHROMEOS_RELEASE_BOARD", &board); | |
| 47 return StartsWithASCII(board, "lumpy", false); | |
| 48 } | |
| 49 | |
| 50 } // namespace | |
| 51 | 40 |
| 52 static const char kFallbackInputMethodLocale[] = "en-US"; | 41 static const char kFallbackInputMethodLocale[] = "en-US"; |
| 53 | 42 |
| 54 Preferences::Preferences() | 43 Preferences::Preferences() |
| 55 : prefs_(NULL), | 44 : prefs_(NULL), |
| 56 input_method_manager_(input_method::InputMethodManager::GetInstance()) { | 45 input_method_manager_(input_method::InputMethodManager::GetInstance()) { |
| 57 } | 46 } |
| 58 | 47 |
| 59 Preferences::Preferences(input_method::InputMethodManager* input_method_manager) | 48 Preferences::Preferences(input_method::InputMethodManager* input_method_manager) |
| 60 : input_method_manager_(input_method_manager) { | 49 : input_method_manager_(input_method_manager) { |
| 61 } | 50 } |
| 62 | 51 |
| 63 Preferences::~Preferences() {} | 52 Preferences::~Preferences() {} |
| 64 | 53 |
| 65 // static | 54 // static |
| 66 void Preferences::RegisterUserPrefs(PrefService* prefs) { | 55 void Preferences::RegisterUserPrefs(PrefService* prefs) { |
| 67 std::string hardware_keyboard_id; | 56 std::string hardware_keyboard_id; |
| 68 // TODO(yusukes): Remove the runtime hack. | 57 // TODO(yusukes): Remove the runtime hack. |
| 69 if (base::chromeos::IsRunningOnChromeOS()) { | 58 if (base::chromeos::IsRunningOnChromeOS()) { |
| 70 input_method::InputMethodManager* manager = | 59 input_method::InputMethodManager* manager = |
| 71 input_method::InputMethodManager::GetInstance(); | 60 input_method::InputMethodManager::GetInstance(); |
| 72 if (manager) { | 61 if (manager) { |
| 73 hardware_keyboard_id = | 62 hardware_keyboard_id = |
| 74 manager->GetInputMethodUtil()->GetHardwareInputMethodId(); | 63 manager->GetInputMethodUtil()->GetHardwareInputMethodId(); |
| 75 } | 64 } |
| 76 } else { | 65 } else { |
| 77 hardware_keyboard_id = "xkb:us::eng"; // only for testing. | 66 hardware_keyboard_id = "xkb:us::eng"; // only for testing. |
| 78 } | 67 } |
| 79 | 68 |
| 80 const bool enable_tap_to_click_default = IsLumpy(); | |
| 81 prefs->RegisterBooleanPref(prefs::kTapToClickEnabled, | 69 prefs->RegisterBooleanPref(prefs::kTapToClickEnabled, |
| 82 enable_tap_to_click_default, | 70 true, |
| 83 PrefService::SYNCABLE_PREF); | 71 PrefService::SYNCABLE_PREF); |
| 84 prefs->RegisterBooleanPref(prefs::kEnableTouchpadThreeFingerClick, | 72 prefs->RegisterBooleanPref(prefs::kEnableTouchpadThreeFingerClick, |
| 85 false, | 73 false, |
| 86 PrefService::UNSYNCABLE_PREF); | 74 PrefService::UNSYNCABLE_PREF); |
| 87 prefs->RegisterBooleanPref(prefs::kNaturalScroll, | 75 prefs->RegisterBooleanPref(prefs::kNaturalScroll, |
| 88 true, | 76 true, |
| 89 PrefService::SYNCABLE_PREF); | 77 PrefService::SYNCABLE_PREF); |
| 90 prefs->RegisterBooleanPref(prefs::kPrimaryMouseButtonRight, | 78 prefs->RegisterBooleanPref(prefs::kPrimaryMouseButtonRight, |
| 91 false, | 79 false, |
| 92 PrefService::SYNCABLE_PREF); | 80 PrefService::SYNCABLE_PREF); |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 | 714 |
| 727 input_method::AutoRepeatRate rate; | 715 input_method::AutoRepeatRate rate; |
| 728 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 716 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); |
| 729 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 717 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); |
| 730 DCHECK(rate.initial_delay_in_ms > 0); | 718 DCHECK(rate.initial_delay_in_ms > 0); |
| 731 DCHECK(rate.repeat_interval_in_ms > 0); | 719 DCHECK(rate.repeat_interval_in_ms > 0); |
| 732 input_method::XKeyboard::SetAutoRepeatRate(rate); | 720 input_method::XKeyboard::SetAutoRepeatRate(rate); |
| 733 } | 721 } |
| 734 | 722 |
| 735 } // namespace chromeos | 723 } // namespace chromeos |
| OLD | NEW |