OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 prefs->RegisterBooleanPref(prefs::kLanguageXkbAutoRepeatEnabled, | 163 prefs->RegisterBooleanPref(prefs::kLanguageXkbAutoRepeatEnabled, |
164 true, | 164 true, |
165 PrefService::UNSYNCABLE_PREF); | 165 PrefService::UNSYNCABLE_PREF); |
166 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatDelay, | 166 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatDelay, |
167 language_prefs::kXkbAutoRepeatDelayInMs, | 167 language_prefs::kXkbAutoRepeatDelayInMs, |
168 PrefService::UNSYNCABLE_PREF); | 168 PrefService::UNSYNCABLE_PREF); |
169 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatInterval, | 169 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatInterval, |
170 language_prefs::kXkbAutoRepeatIntervalInMs, | 170 language_prefs::kXkbAutoRepeatIntervalInMs, |
171 PrefService::UNSYNCABLE_PREF); | 171 PrefService::UNSYNCABLE_PREF); |
172 | 172 |
173 prefs->RegisterDictionaryPref(prefs::kLanguagePreferredVirtualKeyboard, | |
174 PrefService::SYNCABLE_PREF); | |
175 | |
173 // Screen lock default to off. | 176 // Screen lock default to off. |
174 prefs->RegisterBooleanPref(prefs::kEnableScreenLock, | 177 prefs->RegisterBooleanPref(prefs::kEnableScreenLock, |
175 false, | 178 false, |
176 PrefService::SYNCABLE_PREF); | 179 PrefService::SYNCABLE_PREF); |
177 | 180 |
178 // Mobile plan notifications default to on. | 181 // Mobile plan notifications default to on. |
179 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, | 182 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, |
180 true, | 183 true, |
181 PrefService::SYNCABLE_PREF); | 184 PrefService::SYNCABLE_PREF); |
182 | 185 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 language_xkb_auto_repeat_interval_pref_.Init( | 262 language_xkb_auto_repeat_interval_pref_.Init( |
260 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); | 263 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); |
261 | 264 |
262 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); | 265 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); |
263 | 266 |
264 use_shared_proxies_.Init(prefs::kUseSharedProxies, prefs, this); | 267 use_shared_proxies_.Init(prefs::kUseSharedProxies, prefs, this); |
265 | 268 |
266 // Initialize preferences to currently saved state. | 269 // Initialize preferences to currently saved state. |
267 NotifyPrefChanged(NULL); | 270 NotifyPrefChanged(NULL); |
268 | 271 |
272 // Initialize virtual keyboard settings to currently saved state. | |
273 UpdateVirturalKeyboardPreference(prefs); | |
274 | |
269 // If a guest is logged in, initialize the prefs as if this is the first | 275 // If a guest is logged in, initialize the prefs as if this is the first |
270 // login. | 276 // login. |
271 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { | 277 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { |
272 LoginUtils::Get()->SetFirstLoginPrefs(prefs); | 278 LoginUtils::Get()->SetFirstLoginPrefs(prefs); |
273 } | 279 } |
274 } | 280 } |
275 | 281 |
276 void Preferences::Observe(int type, | 282 void Preferences::Observe(int type, |
277 const NotificationSource& source, | 283 const NotificationSource& source, |
278 const NotificationDetails& details) { | 284 const NotificationDetails& details) { |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 void Preferences::UpdateAutoRepeatRate() { | 550 void Preferences::UpdateAutoRepeatRate() { |
545 input_method::AutoRepeatRate rate; | 551 input_method::AutoRepeatRate rate; |
546 rate.initial_delay_in_ms = language_xkb_auto_repeat_delay_pref_.GetValue(); | 552 rate.initial_delay_in_ms = language_xkb_auto_repeat_delay_pref_.GetValue(); |
547 rate.repeat_interval_in_ms = | 553 rate.repeat_interval_in_ms = |
548 language_xkb_auto_repeat_interval_pref_.GetValue(); | 554 language_xkb_auto_repeat_interval_pref_.GetValue(); |
549 DCHECK(rate.initial_delay_in_ms > 0); | 555 DCHECK(rate.initial_delay_in_ms > 0); |
550 DCHECK(rate.repeat_interval_in_ms > 0); | 556 DCHECK(rate.repeat_interval_in_ms > 0); |
551 input_method::SetAutoRepeatRate(rate); | 557 input_method::SetAutoRepeatRate(rate); |
552 } | 558 } |
553 | 559 |
560 void Preferences::UpdateVirturalKeyboardPreference(PrefService* prefs) { | |
561 const DictionaryValue* virtual_keyboard_pref = | |
562 prefs->GetDictionary(prefs::kLanguagePreferredVirtualKeyboard); | |
563 DCHECK(virtual_keyboard_pref); | |
564 | |
565 input_method::InputMethodManager* input_method_manager = | |
566 input_method::InputMethodManager::GetInstance(); | |
567 input_method_manager->ClearVirtualKeyboardPreference(); | |
568 | |
569 for (DictionaryValue::key_iterator iter = virtual_keyboard_pref->begin_keys(); | |
570 iter != virtual_keyboard_pref->end_keys(); | |
571 ++iter) { | |
572 const std::string& input_method_id = *iter; | |
573 std::string url; | |
574 if (!virtual_keyboard_pref->GetString(input_method_id, &url)) | |
575 continue; | |
576 input_method_manager->SetVirtualKeyboardPreference( | |
577 input_method_id, GURL(url)); | |
578 VLOG(1) << "virtual keyboard preference: use " << url | |
bryeung
2011/08/03 22:15:40
I'd rather not have this logging code if it isn't
Yusuke Sato
2011/08/04 07:34:50
Done.
| |
579 << " for " << input_method_id; | |
580 } | |
581 } | |
582 | |
554 } // namespace chromeos | 583 } // namespace chromeos |
OLD | NEW |