Chromium Code Reviews| 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..e315ea6ce577164a620624e432e91b188f23bf9e 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()->InvalidateHardwareInputMethodIdsCache(); |
|
Alexander Alekseev
2014/02/12 14:45:35
Wy do you need to invalidate cache here manually?
Seigo Nonaka
2014/02/12 16:49:51
Because InputMethodDelegate::GetHardwareLayouts ma
|
| + 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)); |