Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2262)

Unified Diff: chrome/browser/chromeos/preferences.cc

Issue 7493077: Add pref entry for virtual keyboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698