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

Unified Diff: chrome/browser/chromeos/login/login_display_host_impl.cc

Issue 139803010: Support comma separated hardware keyboard layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix wrong condition. Created 6 years, 10 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/login/login_display_host_impl.cc
diff --git a/chrome/browser/chromeos/login/login_display_host_impl.cc b/chrome/browser/chromeos/login/login_display_host_impl.cc
index 5e1d4b97817f09c77ad047a47f3ebb5890ce3b02..d80c2e2075fd5fd5529e14d421d10cd35ef7e29f 100644
--- a/chrome/browser/chromeos/login/login_display_host_impl.cc
+++ b/chrome/browser/chromeos/login/login_display_host_impl.cc
@@ -147,11 +147,17 @@ void DetermineAndSaveHardwareKeyboard(const std::string& locale,
if (!layout.empty()) {
PrefService* prefs = g_browser_process->local_state();
prefs->SetString(prefs::kHardwareKeyboardLayout, layout);
+
// This asks the file thread to save the prefs (i.e. doesn't block).
// The latest values of Local State reside in memory so we can safely
// get the value of kHardwareKeyboardLayout even if the data is not
// yet saved to disk.
prefs->CommitPendingWrite();
+
+ chromeos::input_method::InputMethodManager* manager =
+ chromeos::input_method::InputMethodManager::Get();
+ manager->GetInputMethodUtil()->UpdateHardwareLayoutCache();
+ manager->SetInputMethodLoginDefault();
}
}
@@ -1073,7 +1079,7 @@ void ShowLoginWizard(const std::string& first_screen_name) {
// Set up keyboards. For example, when |locale| is "en-US", enable US qwerty
// and US dvorak keyboard layouts.
if (g_browser_process && g_browser_process->local_state()) {
- manager->SetInputMethodDefault();
+ manager->SetInputMethodLoginDefault();
PrefService* prefs = g_browser_process->local_state();
// Apply owner preferences for tap-to-click and mouse buttons swap for
@@ -1140,7 +1146,8 @@ void ShowLoginWizard(const std::string& first_screen_name) {
std::string locale = chromeos::StartupUtils::GetInitialLocale();
prefs->SetString(prefs::kApplicationLocale, locale);
manager->EnableLoginLayouts(
- locale, manager->GetInputMethodUtil()->GetHardwareInputMethodId());
+ locale,
+ manager->GetInputMethodUtil()->GetHardwareInputMethodIds());
base::ThreadRestrictions::ScopedAllowIO allow_io;
const std::string loaded_locale =
ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale);
@@ -1164,14 +1171,18 @@ void ShowLoginWizard(const std::string& first_screen_name) {
VLOG(1) << "Current locale: " << current_locale;
std::string locale = startup_manifest->initial_locale_default();
+ std::string layout = startup_manifest->keyboard_layout();
+ VLOG(1) << "Initial locale: " << locale << "keyboard layout " << layout;
+
+ // Determine keyboard layout from OEM customization (if provided) or
+ // initial locale and save it in preferences.
+ DetermineAndSaveHardwareKeyboard(locale, layout);
+
if (!current_locale.empty() || locale.empty()) {
ShowLoginWizardFinish(first_screen_name, startup_manifest, display_host);
return;
}
- std::string layout = startup_manifest->keyboard_layout();
- VLOG(1) << "Initial locale: " << locale << "keyboard layout " << layout;
-
// Save initial locale from VPD/customization manifest as current
// Chrome locale. Otherwise it will be lost if Chrome restarts.
// Don't need to schedule pref save because setting initial local
@@ -1179,10 +1190,6 @@ void ShowLoginWizard(const std::string& first_screen_name) {
prefs->SetString(prefs::kApplicationLocale, locale);
chromeos::StartupUtils::SetInitialLocale(locale);
- // Determine keyboard layout from OEM customization (if provided) or
- // initial locale and save it in preferences.
- DetermineAndSaveHardwareKeyboard(locale, layout);
-
scoped_ptr<ShowLoginWizardSwitchLanguageCallbackData> data(
new ShowLoginWizardSwitchLanguageCallbackData(
first_screen_name, startup_manifest, display_host));

Powered by Google App Engine
This is Rietveld 408576698