OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/login_display_host_impl.h" | 5 #include "chrome/browser/chromeos/login/ui/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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 #include "ui/gfx/size.h" | 89 #include "ui/gfx/size.h" |
90 #include "ui/gfx/transform.h" | 90 #include "ui/gfx/transform.h" |
91 #include "ui/keyboard/keyboard_controller.h" | 91 #include "ui/keyboard/keyboard_controller.h" |
92 #include "ui/keyboard/keyboard_util.h" | 92 #include "ui/keyboard/keyboard_util.h" |
93 #include "ui/views/focus/focus_manager.h" | 93 #include "ui/views/focus/focus_manager.h" |
94 #include "ui/views/widget/widget.h" | 94 #include "ui/views/widget/widget.h" |
95 #include "ui/views/widget/widget_delegate.h" | 95 #include "ui/views/widget/widget_delegate.h" |
96 #include "ui/wm/core/window_animations.h" | 96 #include "ui/wm/core/window_animations.h" |
97 #include "url/gurl.h" | 97 #include "url/gurl.h" |
98 | 98 |
99 #if defined(USE_ATHENA) | |
100 #include "athena/common/container_priorities.h" | |
101 #include "athena/screen/public/screen_manager.h" | |
102 #endif | |
103 | |
99 namespace { | 104 namespace { |
100 | 105 |
101 // Maximum delay for startup sound after 'loginPromptVisible' signal. | 106 // Maximum delay for startup sound after 'loginPromptVisible' signal. |
102 const int kStartupSoundMaxDelayMs = 2000; | 107 const int kStartupSoundMaxDelayMs = 2000; |
103 | 108 |
104 // URL which corresponds to the login WebUI. | 109 // URL which corresponds to the login WebUI. |
105 const char kLoginURL[] = "chrome://oobe/login"; | 110 const char kLoginURL[] = "chrome://oobe/login"; |
106 | 111 |
107 // URL which corresponds to the OOBE WebUI. | 112 // URL which corresponds to the OOBE WebUI. |
108 const char kOobeURL[] = "chrome://oobe/oobe"; | 113 const char kOobeURL[] = "chrome://oobe/oobe"; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 startup_sound_played_(false), | 287 startup_sound_played_(false), |
283 startup_sound_honors_spoken_feedback_(false), | 288 startup_sound_honors_spoken_feedback_(false), |
284 is_observing_keyboard_(false) { | 289 is_observing_keyboard_(false) { |
285 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 290 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
286 CrasAudioHandler::Get()->AddAudioObserver(this); | 291 CrasAudioHandler::Get()->AddAudioObserver(this); |
287 if (keyboard::KeyboardController::GetInstance()) { | 292 if (keyboard::KeyboardController::GetInstance()) { |
288 keyboard::KeyboardController::GetInstance()->AddObserver(this); | 293 keyboard::KeyboardController::GetInstance()->AddObserver(this); |
289 is_observing_keyboard_ = true; | 294 is_observing_keyboard_ = true; |
290 } | 295 } |
291 | 296 |
297 #if !defined(USE_ATHENA) | |
292 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); | 298 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); |
293 ash::Shell::GetScreen()->AddObserver(this); | 299 ash::Shell::GetScreen()->AddObserver(this); |
300 #endif | |
294 | 301 |
295 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING | 302 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING |
296 // because/ APP_TERMINATING will never be fired as long as this keeps | 303 // because/ APP_TERMINATING will never be fired as long as this keeps |
297 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no | 304 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no |
298 // browser instance that will block the shutdown. | 305 // browser instance that will block the shutdown. |
299 registrar_.Add(this, | 306 registrar_.Add(this, |
300 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 307 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
301 content::NotificationService::AllSources()); | 308 content::NotificationService::AllSources()); |
302 | 309 |
303 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but | 310 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but |
304 // not shown yet. Lock window has to be closed at this point so that | 311 // not shown yet. Lock window has to be closed at this point so that |
305 // a browser window exists and the window can acquire input focus. | 312 // a browser window exists and the window can acquire input focus. |
306 registrar_.Add(this, | 313 registrar_.Add(this, |
307 chrome::NOTIFICATION_BROWSER_OPENED, | 314 chrome::NOTIFICATION_BROWSER_OPENED, |
308 content::NotificationService::AllSources()); | 315 content::NotificationService::AllSources()); |
309 | 316 |
310 // Login screen is moved to lock screen container when user logs in. | 317 // Login screen is moved to lock screen container when user logs in. |
311 registrar_.Add(this, | 318 registrar_.Add(this, |
312 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 319 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
313 content::NotificationService::AllSources()); | 320 content::NotificationService::AllSources()); |
314 | 321 |
315 DCHECK(default_host_ == NULL); | 322 DCHECK(default_host_ == NULL); |
316 default_host_ = this; | 323 default_host_ = this; |
317 | 324 |
325 #if !defined(USE_ATHENA) | |
318 // Make sure chrome won't exit while we are at login/oobe screen. | 326 // Make sure chrome won't exit while we are at login/oobe screen. |
319 chrome::IncrementKeepAliveCount(); | 327 chrome::IncrementKeepAliveCount(); |
oshima
2014/09/09 06:32:50
If someone else may call decrease, you can keep th
Dmitry Polukhin
2014/09/10 20:30:24
Done.
| |
328 #endif | |
320 | 329 |
321 bool is_registered = StartupUtils::IsDeviceRegistered(); | 330 bool is_registered = StartupUtils::IsDeviceRegistered(); |
322 bool zero_delay_enabled = WizardController::IsZeroDelayEnabled(); | 331 bool zero_delay_enabled = WizardController::IsZeroDelayEnabled(); |
323 bool disable_boot_animation = CommandLine::ForCurrentProcess()->HasSwitch( | 332 bool disable_boot_animation = CommandLine::ForCurrentProcess()->HasSwitch( |
324 switches::kDisableBootAnimation); | 333 switches::kDisableBootAnimation); |
325 | 334 |
326 waiting_for_wallpaper_load_ = !zero_delay_enabled && | 335 waiting_for_wallpaper_load_ = !zero_delay_enabled && |
327 (!is_registered || !disable_boot_animation); | 336 (!is_registered || !disable_boot_animation); |
328 | 337 |
338 #if defined(USE_ATHENA) | |
339 // Athena doesn't use wallpaper manager so don't wait for wallpaper loading, | |
oshima
2014/09/09 06:32:50
Athena will use wallpaper manager, so please updat
Dmitry Polukhin
2014/09/10 20:30:24
Done.
| |
340 // crbug.com/408734. | |
341 waiting_for_wallpaper_load_ = false; | |
342 #endif | |
343 | |
329 // For slower hardware we have boot animation disabled so | 344 // For slower hardware we have boot animation disabled so |
330 // we'll be initializing WebUI hidden, waiting for user pods to load and then | 345 // we'll be initializing WebUI hidden, waiting for user pods to load and then |
331 // show WebUI at once. | 346 // show WebUI at once. |
332 waiting_for_user_pods_ = !zero_delay_enabled && !waiting_for_wallpaper_load_; | 347 waiting_for_user_pods_ = !zero_delay_enabled && !waiting_for_wallpaper_load_; |
333 | 348 |
334 initialize_webui_hidden_ = | 349 initialize_webui_hidden_ = |
335 kHiddenWebUIInitializationDefault && !zero_delay_enabled; | 350 kHiddenWebUIInitializationDefault && !zero_delay_enabled; |
336 | 351 |
337 // Check if WebUI init type is overriden. | 352 // Check if WebUI init type is overriden. |
338 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshWebUIInit)) { | 353 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshWebUIInit)) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 } | 399 } |
385 | 400 |
386 LoginDisplayHostImpl::~LoginDisplayHostImpl() { | 401 LoginDisplayHostImpl::~LoginDisplayHostImpl() { |
387 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); | 402 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); |
388 CrasAudioHandler::Get()->RemoveAudioObserver(this); | 403 CrasAudioHandler::Get()->RemoveAudioObserver(this); |
389 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) { | 404 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) { |
390 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); | 405 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); |
391 is_observing_keyboard_ = false; | 406 is_observing_keyboard_ = false; |
392 } | 407 } |
393 | 408 |
409 #if !defined(USE_ATHENA) | |
394 ash::Shell::GetInstance()->delegate()-> | 410 ash::Shell::GetInstance()->delegate()-> |
395 RemoveVirtualKeyboardStateObserver(this); | 411 RemoveVirtualKeyboardStateObserver(this); |
396 ash::Shell::GetScreen()->RemoveObserver(this); | 412 ash::Shell::GetScreen()->RemoveObserver(this); |
413 #endif | |
397 | 414 |
398 if (login_view_ && login_window_) | 415 if (login_view_ && login_window_) |
399 login_window_->RemoveRemovalsObserver(this); | 416 login_window_->RemoveRemovalsObserver(this); |
400 | 417 |
401 if (login::LoginScrollIntoViewEnabled()) | 418 if (login::LoginScrollIntoViewEnabled()) |
402 ResetKeyboardOverscrollOverride(); | 419 ResetKeyboardOverscrollOverride(); |
403 | 420 |
404 views::FocusManager::set_arrow_key_traversal_enabled(false); | 421 views::FocusManager::set_arrow_key_traversal_enabled(false); |
405 ResetLoginWindowAndView(); | 422 ResetLoginWindowAndView(); |
406 | 423 |
424 #if !defined(USE_ATHENA) | |
407 // Let chrome process exit after login/oobe screen if needed. | 425 // Let chrome process exit after login/oobe screen if needed. |
408 chrome::DecrementKeepAliveCount(); | 426 chrome::DecrementKeepAliveCount(); |
427 #endif | |
409 | 428 |
410 default_host_ = NULL; | 429 default_host_ = NULL; |
411 // TODO(tengs): This should be refactored. See crbug.com/314934. | 430 // TODO(tengs): This should be refactored. See crbug.com/314934. |
412 if (user_manager::UserManager::Get()->IsCurrentUserNew()) { | 431 if (user_manager::UserManager::Get()->IsCurrentUserNew()) { |
413 // DriveOptInController will delete itself when finished. | 432 // DriveOptInController will delete itself when finished. |
414 (new DriveFirstRunController( | 433 (new DriveFirstRunController( |
415 ProfileManager::GetActiveUserProfile()))->EnableOfflineMode(); | 434 ProfileManager::GetActiveUserProfile()))->EnableOfflineMode(); |
416 } | 435 } |
417 } | 436 } |
418 | 437 |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
772 // example) are ignored. | 791 // example) are ignored. |
773 OnBrowserCreated(); | 792 OnBrowserCreated(); |
774 registrar_.Remove(this, | 793 registrar_.Remove(this, |
775 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 794 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
776 content::NotificationService::AllSources()); | 795 content::NotificationService::AllSources()); |
777 registrar_.Remove(this, | 796 registrar_.Remove(this, |
778 chrome::NOTIFICATION_BROWSER_OPENED, | 797 chrome::NOTIFICATION_BROWSER_OPENED, |
779 content::NotificationService::AllSources()); | 798 content::NotificationService::AllSources()); |
780 } else if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED && | 799 } else if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED && |
781 user_manager::UserManager::Get()->IsCurrentUserNew()) { | 800 user_manager::UserManager::Get()->IsCurrentUserNew()) { |
801 #if !defined(USE_ATHENA) | |
782 // For new user, move desktop to locker container so that windows created | 802 // For new user, move desktop to locker container so that windows created |
783 // during the user image picker step are below it. | 803 // during the user image picker step are below it. |
784 ash::Shell::GetInstance()-> | 804 ash::Shell::GetInstance()-> |
785 desktop_background_controller()->MoveDesktopToLockedContainer(); | 805 desktop_background_controller()->MoveDesktopToLockedContainer(); |
806 #endif | |
786 registrar_.Remove(this, | 807 registrar_.Remove(this, |
787 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 808 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
788 content::NotificationService::AllSources()); | 809 content::NotificationService::AllSources()); |
789 } | 810 } |
790 } | 811 } |
791 | 812 |
792 //////////////////////////////////////////////////////////////////////////////// | 813 //////////////////////////////////////////////////////////////////////////////// |
793 // LoginDisplayHostImpl, WebContentsObserver implementation: | 814 // LoginDisplayHostImpl, WebContentsObserver implementation: |
794 | 815 |
795 void LoginDisplayHostImpl::RenderProcessGone(base::TerminationStatus status) { | 816 void LoginDisplayHostImpl::RenderProcessGone(base::TerminationStatus status) { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1033 focus_ring_controller_->SetVisible(true); | 1054 focus_ring_controller_->SetVisible(true); |
1034 | 1055 |
1035 keyboard_driven_oobe_key_handler_.reset(new KeyboardDrivenOobeKeyHandler); | 1056 keyboard_driven_oobe_key_handler_.reset(new KeyboardDrivenOobeKeyHandler); |
1036 } | 1057 } |
1037 | 1058 |
1038 views::Widget::InitParams params( | 1059 views::Widget::InitParams params( |
1039 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 1060 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
1040 params.bounds = background_bounds(); | 1061 params.bounds = background_bounds(); |
1041 params.show_state = ui::SHOW_STATE_FULLSCREEN; | 1062 params.show_state = ui::SHOW_STATE_FULLSCREEN; |
1042 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 1063 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
1064 #if defined(USE_ATHENA) | |
1065 athena::ScreenManager::ContainerParams container_params( | |
1066 "LoginScreen", athena::CP_LOGIN_SCREEN); | |
1067 container_params.can_activate_children = true; | |
oshima
2014/09/09 06:32:51
container_params.grab_inputs = true?
Dmitry Polukhin
2014/09/10 20:30:24
It is not required now because other Athena window
oshima
2014/09/10 20:42:27
Acknowledged.
| |
1068 login_screen_container_.reset( | |
1069 athena::ScreenManager::Get()->CreateContainer(container_params)); | |
1070 params.parent = login_screen_container_.get(); | |
1071 #else | |
1043 params.parent = | 1072 params.parent = |
1044 ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), | 1073 ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), |
1045 ash::kShellWindowId_LockScreenContainer); | 1074 ash::kShellWindowId_LockScreenContainer); |
1046 | 1075 #endif |
1047 login_window_ = new views::Widget; | 1076 login_window_ = new views::Widget; |
1048 params.delegate = new LoginWidgetDelegate(login_window_); | 1077 params.delegate = new LoginWidgetDelegate(login_window_); |
1049 login_window_->Init(params); | 1078 login_window_->Init(params); |
1050 | 1079 |
1051 login_view_ = new WebUILoginView(); | 1080 login_view_ = new WebUILoginView(); |
1052 login_view_->Init(); | 1081 login_view_->Init(); |
1053 if (login_view_->webui_visible()) | 1082 if (login_view_->webui_visible()) |
1054 OnLoginPromptVisible(); | 1083 OnLoginPromptVisible(); |
1055 | 1084 |
1056 wm::SetWindowVisibilityAnimationDuration( | 1085 wm::SetWindowVisibilityAnimationDuration( |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1138 // external | 1167 // external |
1139 | 1168 |
1140 // Declared in login_wizard.h so that others don't need to depend on our .h. | 1169 // Declared in login_wizard.h so that others don't need to depend on our .h. |
1141 // TODO(nkostylev): Split this into a smaller functions. | 1170 // TODO(nkostylev): Split this into a smaller functions. |
1142 void ShowLoginWizard(const std::string& first_screen_name) { | 1171 void ShowLoginWizard(const std::string& first_screen_name) { |
1143 if (browser_shutdown::IsTryingToQuit()) | 1172 if (browser_shutdown::IsTryingToQuit()) |
1144 return; | 1173 return; |
1145 | 1174 |
1146 VLOG(1) << "Showing OOBE screen: " << first_screen_name; | 1175 VLOG(1) << "Showing OOBE screen: " << first_screen_name; |
1147 | 1176 |
1177 #if !defined(USE_ATHENA) | |
oshima
2014/09/09 06:32:50
crbug.com/407579
Dmitry Polukhin
2014/09/10 20:30:24
Done.
| |
1148 chromeos::input_method::InputMethodManager* manager = | 1178 chromeos::input_method::InputMethodManager* manager = |
1149 chromeos::input_method::InputMethodManager::Get(); | 1179 chromeos::input_method::InputMethodManager::Get(); |
1150 | 1180 |
1151 // Set up keyboards. For example, when |locale| is "en-US", enable US qwerty | 1181 // Set up keyboards. For example, when |locale| is "en-US", enable US qwerty |
1152 // and US dvorak keyboard layouts. | 1182 // and US dvorak keyboard layouts. |
1153 if (g_browser_process && g_browser_process->local_state()) { | 1183 if (g_browser_process && g_browser_process->local_state()) { |
1154 manager->GetActiveIMEState()->SetInputMethodLoginDefault(); | 1184 manager->GetActiveIMEState()->SetInputMethodLoginDefault(); |
1155 | 1185 |
1156 PrefService* prefs = g_browser_process->local_state(); | 1186 PrefService* prefs = g_browser_process->local_state(); |
1157 // Apply owner preferences for tap-to-click and mouse buttons swap for | 1187 // Apply owner preferences for tap-to-click and mouse buttons swap for |
1158 // login screen. | 1188 // login screen. |
1159 system::InputDeviceSettings::Get()->SetPrimaryButtonRight( | 1189 system::InputDeviceSettings::Get()->SetPrimaryButtonRight( |
1160 prefs->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight)); | 1190 prefs->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight)); |
1161 system::InputDeviceSettings::Get()->SetTapToClick( | 1191 system::InputDeviceSettings::Get()->SetTapToClick( |
1162 prefs->GetBoolean(prefs::kOwnerTapToClickEnabled)); | 1192 prefs->GetBoolean(prefs::kOwnerTapToClickEnabled)); |
1163 } | 1193 } |
1164 system::InputDeviceSettings::Get()->SetNaturalScroll( | 1194 system::InputDeviceSettings::Get()->SetNaturalScroll( |
1165 CommandLine::ForCurrentProcess()->HasSwitch( | 1195 CommandLine::ForCurrentProcess()->HasSwitch( |
1166 switches::kNaturalScrollDefault)); | 1196 switches::kNaturalScrollDefault)); |
1197 #endif | |
1167 | 1198 |
1168 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); | 1199 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
1169 | 1200 |
1170 g_browser_process->platform_part()->SessionManager()->SetSessionState( | 1201 g_browser_process->platform_part()->SessionManager()->SetSessionState( |
1171 StartupUtils::IsOobeCompleted() | 1202 StartupUtils::IsOobeCompleted() |
1172 ? session_manager::SESSION_STATE_LOGIN_PRIMARY | 1203 ? session_manager::SESSION_STATE_LOGIN_PRIMARY |
1173 : session_manager::SESSION_STATE_OOBE); | 1204 : session_manager::SESSION_STATE_OOBE); |
1174 | 1205 |
1175 LoginDisplayHost* display_host = new LoginDisplayHostImpl(screen_bounds); | 1206 LoginDisplayHost* display_host = new LoginDisplayHostImpl(screen_bounds); |
1176 | 1207 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1227 // EmitLoginPromptReady. | 1258 // EmitLoginPromptReady. |
1228 PrefService* prefs = g_browser_process->local_state(); | 1259 PrefService* prefs = g_browser_process->local_state(); |
1229 const std::string& current_locale = | 1260 const std::string& current_locale = |
1230 prefs->GetString(prefs::kApplicationLocale); | 1261 prefs->GetString(prefs::kApplicationLocale); |
1231 VLOG(1) << "Current locale: " << current_locale; | 1262 VLOG(1) << "Current locale: " << current_locale; |
1232 const std::string& locale = startup_manifest->initial_locale_default(); | 1263 const std::string& locale = startup_manifest->initial_locale_default(); |
1233 | 1264 |
1234 const std::string& layout = startup_manifest->keyboard_layout(); | 1265 const std::string& layout = startup_manifest->keyboard_layout(); |
1235 VLOG(1) << "Initial locale: " << locale << "keyboard layout " << layout; | 1266 VLOG(1) << "Initial locale: " << locale << "keyboard layout " << layout; |
1236 | 1267 |
1268 #if !defined(USE_ATHENA) | |
1237 // Determine keyboard layout from OEM customization (if provided) or | 1269 // Determine keyboard layout from OEM customization (if provided) or |
1238 // initial locale and save it in preferences. | 1270 // initial locale and save it in preferences. |
1239 manager->GetActiveIMEState()->SetInputMethodLoginDefaultFromVPD(locale, | 1271 manager->GetActiveIMEState()->SetInputMethodLoginDefaultFromVPD(locale, |
1240 layout); | 1272 layout); |
1273 #endif | |
1241 | 1274 |
1242 if (!current_locale.empty() || locale.empty()) { | 1275 if (!current_locale.empty() || locale.empty()) { |
1243 ShowLoginWizardFinish(first_screen_name, startup_manifest, display_host); | 1276 ShowLoginWizardFinish(first_screen_name, startup_manifest, display_host); |
1244 return; | 1277 return; |
1245 } | 1278 } |
1246 | 1279 |
1247 // Save initial locale from VPD/customization manifest as current | 1280 // Save initial locale from VPD/customization manifest as current |
1248 // Chrome locale. Otherwise it will be lost if Chrome restarts. | 1281 // Chrome locale. Otherwise it will be lost if Chrome restarts. |
1249 // Don't need to schedule pref save because setting initial local | 1282 // Don't need to schedule pref save because setting initial local |
1250 // will enforce preference saving. | 1283 // will enforce preference saving. |
1251 prefs->SetString(prefs::kApplicationLocale, locale); | 1284 prefs->SetString(prefs::kApplicationLocale, locale); |
1252 StartupUtils::SetInitialLocale(locale); | 1285 StartupUtils::SetInitialLocale(locale); |
1253 | 1286 |
1254 scoped_ptr<ShowLoginWizardSwitchLanguageCallbackData> data( | 1287 scoped_ptr<ShowLoginWizardSwitchLanguageCallbackData> data( |
1255 new ShowLoginWizardSwitchLanguageCallbackData( | 1288 new ShowLoginWizardSwitchLanguageCallbackData( |
1256 first_screen_name, startup_manifest, display_host)); | 1289 first_screen_name, startup_manifest, display_host)); |
1257 | 1290 |
1258 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 1291 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
1259 new locale_util::SwitchLanguageCallback( | 1292 new locale_util::SwitchLanguageCallback( |
1260 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); | 1293 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); |
1261 | 1294 |
1262 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1295 // Load locale keyboards here. Hardware layout would be automatically enabled. |
1263 locale_util::SwitchLanguage( | 1296 locale_util::SwitchLanguage( |
1264 locale, true, true /* login_layouts_only */, callback.Pass()); | 1297 locale, true, true /* login_layouts_only */, callback.Pass()); |
1265 } | 1298 } |
1266 | 1299 |
1267 } // namespace chromeos | 1300 } // namespace chromeos |
OLD | NEW |