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

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: rebase Created 9 years, 4 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
« no previous file with comments | « chrome/browser/chromeos/preferences.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/preferences.cc
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index 27e399b1be0f890813b707e9f2a79fd29e1761cb..ef02d2090ab1127e459b3b33b9f29c3b1c75c554 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -174,6 +174,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,
@@ -280,6 +283,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)) {
@@ -570,4 +576,25 @@ 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->ClearAllVirtualKeyboardPreferences();
+
+ std::string url;
+ for (DictionaryValue::key_iterator iter = virtual_keyboard_pref->begin_keys();
+ iter != virtual_keyboard_pref->end_keys();
+ ++iter) {
+ const std::string& input_method_id = *iter;
+ if (!virtual_keyboard_pref->GetString(input_method_id, &url))
+ continue;
+ input_method_manager->SetVirtualKeyboardPreference(
+ input_method_id, GURL(url));
+ }
+}
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/preferences.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698