summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/preferences.cc
diff options
context:
space:
mode:
authoryusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 04:38:59 +0000
committeryusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 04:38:59 +0000
commita995b3951040512507269b70b527fd7fc408da2b (patch)
tree59686a66ed2405c8357e9a20e29141590e12555c /chrome/browser/chromeos/preferences.cc
parent4605be79a582881a1987b79694437be52df959af (diff)
downloadchromium_src-a995b3951040512507269b70b527fd7fc408da2b.zip
chromium_src-a995b3951040512507269b70b527fd7fc408da2b.tar.gz
chromium_src-a995b3951040512507269b70b527fd7fc408da2b.tar.bz2
Add Views UI for setting keyboard repeat delay and repeat interval.
BUG=chromium-os:4102 TEST=ran unit_tests Review URL: http://codereview.chromium.org/3023044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/preferences.cc')
-rw-r--r--chrome/browser/chromeos/preferences.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index 30a53d8..15594bb 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -87,6 +87,11 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterIntegerPref(
kXkbModifierMultipleChoicePrefs.pref_name,
kXkbModifierMultipleChoicePrefs.default_pref_value);
+ prefs->RegisterBooleanPref(prefs::kLanguageXkbAutoRepeatEnabled, true);
+ prefs->RegisterIntegerPref(kXkbAutoRepeatDelayPref.pref_name,
+ kXkbAutoRepeatDelayPref.default_pref_value);
+ prefs->RegisterIntegerPref(kXkbAutoRepeatIntervalPref.pref_name,
+ kXkbAutoRepeatIntervalPref.default_pref_value);
}
void Preferences::Init(PrefService* prefs) {
@@ -143,6 +148,12 @@ void Preferences::Init(PrefService* prefs) {
}
language_xkb_modifier_remap_.Init(
kXkbModifierMultipleChoicePrefs.pref_name, prefs, this);
+ language_xkb_auto_repeat_enabled_.Init(
+ prefs::kLanguageXkbAutoRepeatEnabled, prefs, this);
+ language_xkb_auto_repeat_delay_pref_.Init(
+ kXkbAutoRepeatDelayPref.pref_name, prefs, this);
+ language_xkb_auto_repeat_interval_pref_.Init(
+ kXkbAutoRepeatIntervalPref.pref_name, prefs, this);
std::string locale(g_browser_process->GetApplicationLocale());
// Add input methods based on the application locale when the user first
@@ -333,6 +344,14 @@ void Preferences::NotifyPrefChanged(const std::string* pref_name) {
}
CrosLibrary::Get()->GetKeyboardLibrary()->RemapModifierKeys(modifier_map);
}
+ if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) {
+ const bool enabled = language_xkb_auto_repeat_enabled_.GetValue();
+ CrosLibrary::Get()->GetKeyboardLibrary()->SetAutoRepeatEnabled(enabled);
+ }
+ if (!pref_name || ((*pref_name == prefs::kLanguageXkbAutoRepeatDelay) ||
+ (*pref_name == prefs::kLanguageXkbAutoRepeatInterval))) {
+ UpdateAutoRepeatRate();
+ }
}
void Preferences::SetLanguageConfigBoolean(const char* section,
@@ -392,4 +411,14 @@ void Preferences::SetLanguageConfigStringListAsCSV(const char* section,
SetLanguageConfigStringList(section, name, split_values);
}
+void Preferences::UpdateAutoRepeatRate() {
+ AutoRepeatRate rate;
+ rate.initial_delay_in_ms = language_xkb_auto_repeat_delay_pref_.GetValue();
+ rate.repeat_interval_in_ms =
+ language_xkb_auto_repeat_interval_pref_.GetValue();
+ DCHECK(rate.initial_delay_in_ms > 0);
+ DCHECK(rate.repeat_interval_in_ms > 0);
+ CrosLibrary::Get()->GetKeyboardLibrary()->SetAutoRepeatRate(rate);
+}
+
} // namespace chromeos