Chromium Code Reviews| Index: chrome/browser/chromeos/preferences.cc |
| diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc |
| index 5cd8e6cf2724d66e382de36acc73a18b1bd72a76..2247d900c1b77aba6cbf0e707b2f94b88311547b 100644 |
| --- a/chrome/browser/chromeos/preferences.cc |
| +++ b/chrome/browser/chromeos/preferences.cc |
| @@ -170,6 +170,9 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { |
| language_prefs::kXkbAutoRepeatIntervalInMs, |
| PrefService::UNSYNCABLE_PREF); |
| + prefs->RegisterDictionaryPref(prefs::kLanguagePreferredVirtualKeyboard, |
| + PrefService::SYNCABLE_PREF); |
| + |
| // Screen lock default to off. |
| prefs->RegisterBooleanPref(prefs::kEnableScreenLock, |
| false, |
| @@ -266,6 +269,9 @@ void Preferences::Init(PrefService* prefs) { |
| // Initialize preferences to currently saved state. |
| NotifyPrefChanged(NULL); |
| + // Initialize virtual keyboard settings to currently saved state. |
| + UpdateVirturalKeyboardPreference(prefs); |
| + |
| // If a guest is logged in, initialize the prefs as if this is the first |
| // login. |
| if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { |
| @@ -551,4 +557,27 @@ void Preferences::UpdateAutoRepeatRate() { |
| input_method::SetAutoRepeatRate(rate); |
| } |
| +void Preferences::UpdateVirturalKeyboardPreference(PrefService* prefs) { |
| + const DictionaryValue* virtual_keyboard_pref = |
| + prefs->GetDictionary(prefs::kLanguagePreferredVirtualKeyboard); |
| + DCHECK(virtual_keyboard_pref); |
| + |
| + input_method::InputMethodManager* input_method_manager = |
| + input_method::InputMethodManager::GetInstance(); |
| + input_method_manager->ClearVirtualKeyboardPreference(); |
| + |
| + for (DictionaryValue::key_iterator iter = virtual_keyboard_pref->begin_keys(); |
| + iter != virtual_keyboard_pref->end_keys(); |
| + ++iter) { |
| + const std::string& input_method_id = *iter; |
| + std::string url; |
| + if (!virtual_keyboard_pref->GetString(input_method_id, &url)) |
| + continue; |
| + input_method_manager->SetVirtualKeyboardPreference( |
| + input_method_id, GURL(url)); |
| + 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.
|
| + << " for " << input_method_id; |
| + } |
| +} |
| + |
| } // namespace chromeos |