| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 5 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/audio/sounds.h" | 9 #include "ash/audio/sounds.h" |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| (...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 // R11 > R12 migration fix. See http://crosbug.com/p/4898. | 1131 // R11 > R12 migration fix. See http://crosbug.com/p/4898. |
| 1132 // If user has manually changed locale during R11 OOBE, locale will be set. | 1132 // If user has manually changed locale during R11 OOBE, locale will be set. |
| 1133 // On R12 > R12|R13 etc. this fix won't get activated since | 1133 // On R12 > R12|R13 etc. this fix won't get activated since |
| 1134 // OOBE process has set kApplicationLocale to non-default value. | 1134 // OOBE process has set kApplicationLocale to non-default value. |
| 1135 PrefService* prefs = g_browser_process->local_state(); | 1135 PrefService* prefs = g_browser_process->local_state(); |
| 1136 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { | 1136 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { |
| 1137 std::string locale = chromeos::StartupUtils::GetInitialLocale(); | 1137 std::string locale = chromeos::StartupUtils::GetInitialLocale(); |
| 1138 prefs->SetString(prefs::kApplicationLocale, locale); | 1138 prefs->SetString(prefs::kApplicationLocale, locale); |
| 1139 manager->EnableLayouts( | 1139 manager->EnableLayouts( |
| 1140 locale, | 1140 locale, |
| 1141 manager->GetInputMethodUtil()->GetHardwareInputMethodId()); | 1141 manager->GetInputMethodUtil()->GetHardwareInputMethodId(), |
| 1142 true /* login_layouts_only */); |
| 1142 base::ThreadRestrictions::ScopedAllowIO allow_io; | 1143 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 1143 const std::string loaded_locale = | 1144 const std::string loaded_locale = |
| 1144 ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); | 1145 ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); |
| 1145 g_browser_process->SetApplicationLocale(loaded_locale); | 1146 g_browser_process->SetApplicationLocale(loaded_locale); |
| 1146 } | 1147 } |
| 1147 display_host->StartSignInScreen(LoginScreenContext()); | 1148 display_host->StartSignInScreen(LoginScreenContext()); |
| 1148 return; | 1149 return; |
| 1149 } | 1150 } |
| 1150 | 1151 |
| 1151 // Load startup manifest. | 1152 // Load startup manifest. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1174 // Chrome locale. Otherwise it will be lost if Chrome restarts. | 1175 // Chrome locale. Otherwise it will be lost if Chrome restarts. |
| 1175 // Don't need to schedule pref save because setting initial local | 1176 // Don't need to schedule pref save because setting initial local |
| 1176 // will enforce preference saving. | 1177 // will enforce preference saving. |
| 1177 prefs->SetString(prefs::kApplicationLocale, locale); | 1178 prefs->SetString(prefs::kApplicationLocale, locale); |
| 1178 chromeos::StartupUtils::SetInitialLocale(locale); | 1179 chromeos::StartupUtils::SetInitialLocale(locale); |
| 1179 | 1180 |
| 1180 // Determine keyboard layout from OEM customization (if provided) or | 1181 // Determine keyboard layout from OEM customization (if provided) or |
| 1181 // initial locale and save it in preferences. | 1182 // initial locale and save it in preferences. |
| 1182 DetermineAndSaveHardwareKeyboard(locale, layout); | 1183 DetermineAndSaveHardwareKeyboard(locale, layout); |
| 1183 | 1184 |
| 1184 // Then, enable the hardware keyboard. | |
| 1185 manager->EnableLayouts( | |
| 1186 locale, manager->GetInputMethodUtil()->GetHardwareInputMethodId()); | |
| 1187 | |
| 1188 scoped_ptr<ShowLoginWizardSwitchLanguageCallbackData> data( | 1185 scoped_ptr<ShowLoginWizardSwitchLanguageCallbackData> data( |
| 1189 new ShowLoginWizardSwitchLanguageCallbackData( | 1186 new ShowLoginWizardSwitchLanguageCallbackData( |
| 1190 first_screen_name, startup_manifest, display_host)); | 1187 first_screen_name, startup_manifest, display_host)); |
| 1191 | 1188 |
| 1192 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 1189 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
| 1193 new locale_util::SwitchLanguageCallback( | 1190 new locale_util::SwitchLanguageCallback( |
| 1194 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); | 1191 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); |
| 1195 | 1192 |
| 1196 // Do not load locale keyboards here. | 1193 // Load locale keyboards here. Hardware layout would be automatically enabled. |
| 1197 locale_util::SwitchLanguage(locale, false, callback.Pass()); | 1194 locale_util::SwitchLanguage( |
| 1195 locale, true, true /* login_layouts_only */, callback.Pass()); |
| 1198 } | 1196 } |
| 1199 | 1197 |
| 1200 } // namespace chromeos | 1198 } // namespace chromeos |
| OLD | NEW |