| 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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 | 1129 |
| 1130 if (show_login_screen) { | 1130 if (show_login_screen) { |
| 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->EnableLoginLayouts( |
| 1140 locale, | 1140 locale, manager->GetInputMethodUtil()->GetHardwareInputMethodId()); |
| 1141 manager->GetInputMethodUtil()->GetHardwareInputMethodId()); | |
| 1142 base::ThreadRestrictions::ScopedAllowIO allow_io; | 1141 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 1143 const std::string loaded_locale = | 1142 const std::string loaded_locale = |
| 1144 ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); | 1143 ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); |
| 1145 g_browser_process->SetApplicationLocale(loaded_locale); | 1144 g_browser_process->SetApplicationLocale(loaded_locale); |
| 1146 } | 1145 } |
| 1147 display_host->StartSignInScreen(LoginScreenContext()); | 1146 display_host->StartSignInScreen(LoginScreenContext()); |
| 1148 return; | 1147 return; |
| 1149 } | 1148 } |
| 1150 | 1149 |
| 1151 // Load startup manifest. | 1150 // Load startup manifest. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1174 // Chrome locale. Otherwise it will be lost if Chrome restarts. | 1173 // Chrome locale. Otherwise it will be lost if Chrome restarts. |
| 1175 // Don't need to schedule pref save because setting initial local | 1174 // Don't need to schedule pref save because setting initial local |
| 1176 // will enforce preference saving. | 1175 // will enforce preference saving. |
| 1177 prefs->SetString(prefs::kApplicationLocale, locale); | 1176 prefs->SetString(prefs::kApplicationLocale, locale); |
| 1178 chromeos::StartupUtils::SetInitialLocale(locale); | 1177 chromeos::StartupUtils::SetInitialLocale(locale); |
| 1179 | 1178 |
| 1180 // Determine keyboard layout from OEM customization (if provided) or | 1179 // Determine keyboard layout from OEM customization (if provided) or |
| 1181 // initial locale and save it in preferences. | 1180 // initial locale and save it in preferences. |
| 1182 DetermineAndSaveHardwareKeyboard(locale, layout); | 1181 DetermineAndSaveHardwareKeyboard(locale, layout); |
| 1183 | 1182 |
| 1184 // Then, enable the hardware keyboard. | |
| 1185 manager->EnableLayouts( | |
| 1186 locale, manager->GetInputMethodUtil()->GetHardwareInputMethodId()); | |
| 1187 | |
| 1188 scoped_ptr<ShowLoginWizardSwitchLanguageCallbackData> data( | 1183 scoped_ptr<ShowLoginWizardSwitchLanguageCallbackData> data( |
| 1189 new ShowLoginWizardSwitchLanguageCallbackData( | 1184 new ShowLoginWizardSwitchLanguageCallbackData( |
| 1190 first_screen_name, startup_manifest, display_host)); | 1185 first_screen_name, startup_manifest, display_host)); |
| 1191 | 1186 |
| 1192 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 1187 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
| 1193 new locale_util::SwitchLanguageCallback( | 1188 new locale_util::SwitchLanguageCallback( |
| 1194 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); | 1189 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); |
| 1195 | 1190 |
| 1196 // Do not load locale keyboards here. | 1191 // Load locale keyboards here. Hardware layout would be automatically enabled. |
| 1197 locale_util::SwitchLanguage(locale, false, callback.Pass()); | 1192 locale_util::SwitchLanguage( |
| 1193 locale, true, true /* login_layouts_only */, callback.Pass()); |
| 1198 } | 1194 } |
| 1199 | 1195 |
| 1200 } // namespace chromeos | 1196 } // namespace chromeos |
| OLD | NEW |