| 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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 | 1133 |
| 1134 if (show_login_screen) { | 1134 if (show_login_screen) { |
| 1135 // R11 > R12 migration fix. See http://crosbug.com/p/4898. | 1135 // R11 > R12 migration fix. See http://crosbug.com/p/4898. |
| 1136 // If user has manually changed locale during R11 OOBE, locale will be set. | 1136 // If user has manually changed locale during R11 OOBE, locale will be set. |
| 1137 // On R12 > R12|R13 etc. this fix won't get activated since | 1137 // On R12 > R12|R13 etc. this fix won't get activated since |
| 1138 // OOBE process has set kApplicationLocale to non-default value. | 1138 // OOBE process has set kApplicationLocale to non-default value. |
| 1139 PrefService* prefs = g_browser_process->local_state(); | 1139 PrefService* prefs = g_browser_process->local_state(); |
| 1140 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { | 1140 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { |
| 1141 std::string locale = chromeos::StartupUtils::GetInitialLocale(); | 1141 std::string locale = chromeos::StartupUtils::GetInitialLocale(); |
| 1142 prefs->SetString(prefs::kApplicationLocale, locale); | 1142 prefs->SetString(prefs::kApplicationLocale, locale); |
| 1143 manager->EnableLayouts( | 1143 manager->EnableLoginLayouts( |
| 1144 locale, | 1144 locale, manager->GetInputMethodUtil()->GetHardwareInputMethodId()); |
| 1145 manager->GetInputMethodUtil()->GetHardwareInputMethodId()); | |
| 1146 base::ThreadRestrictions::ScopedAllowIO allow_io; | 1145 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 1147 const std::string loaded_locale = | 1146 const std::string loaded_locale = |
| 1148 ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); | 1147 ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); |
| 1149 g_browser_process->SetApplicationLocale(loaded_locale); | 1148 g_browser_process->SetApplicationLocale(loaded_locale); |
| 1150 } | 1149 } |
| 1151 display_host->StartSignInScreen(LoginScreenContext()); | 1150 display_host->StartSignInScreen(LoginScreenContext()); |
| 1152 return; | 1151 return; |
| 1153 } | 1152 } |
| 1154 | 1153 |
| 1155 // Load startup manifest. | 1154 // Load startup manifest. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1178 // Chrome locale. Otherwise it will be lost if Chrome restarts. | 1177 // Chrome locale. Otherwise it will be lost if Chrome restarts. |
| 1179 // Don't need to schedule pref save because setting initial local | 1178 // Don't need to schedule pref save because setting initial local |
| 1180 // will enforce preference saving. | 1179 // will enforce preference saving. |
| 1181 prefs->SetString(prefs::kApplicationLocale, locale); | 1180 prefs->SetString(prefs::kApplicationLocale, locale); |
| 1182 chromeos::StartupUtils::SetInitialLocale(locale); | 1181 chromeos::StartupUtils::SetInitialLocale(locale); |
| 1183 | 1182 |
| 1184 // Determine keyboard layout from OEM customization (if provided) or | 1183 // Determine keyboard layout from OEM customization (if provided) or |
| 1185 // initial locale and save it in preferences. | 1184 // initial locale and save it in preferences. |
| 1186 DetermineAndSaveHardwareKeyboard(locale, layout); | 1185 DetermineAndSaveHardwareKeyboard(locale, layout); |
| 1187 | 1186 |
| 1188 // Then, enable the hardware keyboard. | |
| 1189 manager->EnableLayouts( | |
| 1190 locale, manager->GetInputMethodUtil()->GetHardwareInputMethodId()); | |
| 1191 | |
| 1192 scoped_ptr<ShowLoginWizardSwitchLanguageCallbackData> data( | 1187 scoped_ptr<ShowLoginWizardSwitchLanguageCallbackData> data( |
| 1193 new ShowLoginWizardSwitchLanguageCallbackData( | 1188 new ShowLoginWizardSwitchLanguageCallbackData( |
| 1194 first_screen_name, startup_manifest, display_host)); | 1189 first_screen_name, startup_manifest, display_host)); |
| 1195 | 1190 |
| 1196 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 1191 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
| 1197 new locale_util::SwitchLanguageCallback( | 1192 new locale_util::SwitchLanguageCallback( |
| 1198 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); | 1193 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); |
| 1199 | 1194 |
| 1200 // Do not load locale keyboards here. | 1195 // Load locale keyboards here. Hardware layout would be automatically enabled. |
| 1201 locale_util::SwitchLanguage(locale, false, callback.Pass()); | 1196 locale_util::SwitchLanguage( |
| 1197 locale, true, true /* login_layouts_only */, callback.Pass()); |
| 1202 } | 1198 } |
| 1203 | 1199 |
| 1204 } // namespace chromeos | 1200 } // namespace chromeos |
| OLD | NEW |