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 "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/chromeos/customization_document.h" | 21 #include "chrome/browser/chromeos/customization_document.h" |
22 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 22 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
23 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 23 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
24 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 24 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
25 #include "chrome/browser/chromeos/language_preferences.h" | 25 #include "chrome/browser/chromeos/language_preferences.h" |
26 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 26 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
27 #include "chrome/browser/chromeos/login/helper.h" | 27 #include "chrome/browser/chromeos/login/helper.h" |
28 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 28 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
29 #include "chrome/browser/chromeos/login/login_utils.h" | 29 #include "chrome/browser/chromeos/login/login_utils.h" |
30 #include "chrome/browser/chromeos/login/login_wizard.h" | 30 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 31 #include "chrome/browser/chromeos/login/startup_utils.h" |
31 #include "chrome/browser/chromeos/login/user_manager.h" | 32 #include "chrome/browser/chromeos/login/user_manager.h" |
32 #include "chrome/browser/chromeos/login/webui_login_display_host.h" | 33 #include "chrome/browser/chromeos/login/webui_login_display_host.h" |
33 #include "chrome/browser/chromeos/login/wizard_controller.h" | 34 #include "chrome/browser/chromeos/login/wizard_controller.h" |
34 #include "chrome/browser/chromeos/mobile_config.h" | 35 #include "chrome/browser/chromeos/mobile_config.h" |
35 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h" | 36 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h" |
36 #include "chrome/browser/chromeos/system/input_device_settings.h" | 37 #include "chrome/browser/chromeos/system/input_device_settings.h" |
37 #include "chrome/browser/chromeos/system/timezone_settings.h" | 38 #include "chrome/browser/chromeos/system/timezone_settings.h" |
38 #include "chrome/browser/lifetime/application_lifetime.h" | 39 #include "chrome/browser/lifetime/application_lifetime.h" |
39 #include "chrome/browser/managed_mode/managed_mode.h" | 40 #include "chrome/browser/managed_mode/managed_mode.h" |
40 #include "chrome/browser/policy/browser_policy_connector.h" | 41 #include "chrome/browser/policy/browser_policy_connector.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 const std::string& first_screen_name, | 187 const std::string& first_screen_name, |
187 DictionaryValue* screen_parameters) { | 188 DictionaryValue* screen_parameters) { |
188 DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name; | 189 DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name; |
189 // Create and show the wizard. | 190 // Create and show the wizard. |
190 // Note, dtor of the old WizardController should be called before ctor of the | 191 // Note, dtor of the old WizardController should be called before ctor of the |
191 // new one, because "default_controller()" is updated there. So pure "reset()" | 192 // new one, because "default_controller()" is updated there. So pure "reset()" |
192 // is done before new controller creation. | 193 // is done before new controller creation. |
193 wizard_controller_.reset(); | 194 wizard_controller_.reset(); |
194 wizard_controller_.reset(CreateWizardController()); | 195 wizard_controller_.reset(CreateWizardController()); |
195 | 196 |
196 oobe_progress_bar_visible_ = !WizardController::IsDeviceRegistered(); | 197 oobe_progress_bar_visible_ = !StartupUtils::IsDeviceRegistered(); |
197 SetOobeProgressBarVisible(oobe_progress_bar_visible_); | 198 SetOobeProgressBarVisible(oobe_progress_bar_visible_); |
198 wizard_controller_->Init(first_screen_name, screen_parameters); | 199 wizard_controller_->Init(first_screen_name, screen_parameters); |
199 } | 200 } |
200 | 201 |
201 void LoginDisplayHostImpl::StartSignInScreen() { | 202 void LoginDisplayHostImpl::StartSignInScreen() { |
202 DVLOG(1) << "Starting sign in screen"; | 203 DVLOG(1) << "Starting sign in screen"; |
203 const chromeos::UserList& users = chromeos::UserManager::Get()->GetUsers(); | 204 const chromeos::UserList& users = chromeos::UserManager::Get()->GetUsers(); |
204 | 205 |
205 // Fix for users who updated device and thus never passed register screen. | 206 // Fix for users who updated device and thus never passed register screen. |
206 // If we already have users, we assume that it is not a second part of | 207 // If we already have users, we assume that it is not a second part of |
207 // OOBE. See http://crosbug.com/6289 | 208 // OOBE. See http://crosbug.com/6289 |
208 if (!WizardController::IsDeviceRegistered() && !users.empty()) { | 209 if (!StartupUtils::IsDeviceRegistered() && !users.empty()) { |
209 VLOG(1) << "Mark device registered because there are remembered users: " | 210 VLOG(1) << "Mark device registered because there are remembered users: " |
210 << users.size(); | 211 << users.size(); |
211 WizardController::MarkDeviceRegistered(); | 212 StartupUtils::MarkDeviceRegistered(); |
212 } | 213 } |
213 | 214 |
214 sign_in_controller_.reset(); // Only one controller in a time. | 215 sign_in_controller_.reset(); // Only one controller in a time. |
215 sign_in_controller_.reset(new chromeos::ExistingUserController(this)); | 216 sign_in_controller_.reset(new chromeos::ExistingUserController(this)); |
216 oobe_progress_bar_visible_ = !WizardController::IsDeviceRegistered(); | 217 oobe_progress_bar_visible_ = !StartupUtils::IsDeviceRegistered(); |
217 SetOobeProgressBarVisible(oobe_progress_bar_visible_); | 218 SetOobeProgressBarVisible(oobe_progress_bar_visible_); |
218 SetStatusAreaVisible(true); | 219 SetStatusAreaVisible(true); |
219 SetShutdownButtonEnabled(true); | 220 SetShutdownButtonEnabled(true); |
220 sign_in_controller_->Init(users); | 221 sign_in_controller_->Init(users); |
221 | 222 |
222 // We might be here after a reboot that was triggered after OOBE was complete, | 223 // We might be here after a reboot that was triggered after OOBE was complete, |
223 // so check for auto-enrollment again. This might catch a cached decision from | 224 // so check for auto-enrollment again. This might catch a cached decision from |
224 // a previous oobe flow, or might start a new check with the server. | 225 // a previous oobe flow, or might start a new check with the server. |
225 CheckForAutoEnrollment(); | 226 CheckForAutoEnrollment(); |
226 | 227 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 system::touchpad_settings::SetTapToClick( | 412 system::touchpad_settings::SetTapToClick( |
412 prefs->GetBoolean(prefs::kOwnerTapToClickEnabled)); | 413 prefs->GetBoolean(prefs::kOwnerTapToClickEnabled)); |
413 } | 414 } |
414 | 415 |
415 ui::SetNaturalScroll(CommandLine::ForCurrentProcess()->HasSwitch( | 416 ui::SetNaturalScroll(CommandLine::ForCurrentProcess()->HasSwitch( |
416 switches::kNaturalScrollDefault)); | 417 switches::kNaturalScrollDefault)); |
417 | 418 |
418 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(size)); | 419 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(size)); |
419 | 420 |
420 // Check whether we need to execute OOBE process. | 421 // Check whether we need to execute OOBE process. |
421 bool oobe_complete = chromeos::WizardController::IsOobeCompleted(); | 422 bool oobe_complete = chromeos::StartupUtils::IsOobeCompleted(); |
422 if (!oobe_complete) { | 423 if (!oobe_complete) { |
423 LoginState::Get()->SetLoggedInState( | 424 LoginState::Get()->SetLoggedInState( |
424 LoginState::LOGGED_IN_OOBE, LoginState::LOGGED_IN_USER_NONE); | 425 LoginState::LOGGED_IN_OOBE, LoginState::LOGGED_IN_USER_NONE); |
425 } else { | 426 } else { |
426 LoginState::Get()->SetLoggedInState( | 427 LoginState::Get()->SetLoggedInState( |
427 LoginState::LOGGED_IN_NONE, LoginState::LOGGED_IN_USER_NONE); | 428 LoginState::LOGGED_IN_NONE, LoginState::LOGGED_IN_USER_NONE); |
428 } | 429 } |
429 bool show_login_screen = | 430 bool show_login_screen = |
430 (first_screen_name.empty() && oobe_complete) || | 431 (first_screen_name.empty() && oobe_complete) || |
431 first_screen_name == chromeos::WizardController::kLoginScreenName; | 432 first_screen_name == chromeos::WizardController::kLoginScreenName; |
432 | 433 |
433 chromeos::LoginDisplayHost* display_host; | 434 chromeos::LoginDisplayHost* display_host; |
434 display_host = new chromeos::WebUILoginDisplayHost(screen_bounds); | 435 display_host = new chromeos::WebUILoginDisplayHost(screen_bounds); |
435 | 436 |
436 if (show_login_screen) { | 437 if (show_login_screen) { |
437 // R11 > R12 migration fix. See http://crosbug.com/p/4898. | 438 // R11 > R12 migration fix. See http://crosbug.com/p/4898. |
438 // If user has manually changed locale during R11 OOBE, locale will be set. | 439 // If user has manually changed locale during R11 OOBE, locale will be set. |
439 // On R12 > R12|R13 etc. this fix won't get activated since | 440 // On R12 > R12|R13 etc. this fix won't get activated since |
440 // OOBE process has set kApplicationLocale to non-default value. | 441 // OOBE process has set kApplicationLocale to non-default value. |
441 PrefService* prefs = g_browser_process->local_state(); | 442 PrefService* prefs = g_browser_process->local_state(); |
442 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { | 443 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { |
443 std::string locale = chromeos::WizardController::GetInitialLocale(); | 444 std::string locale = chromeos::StartupUtils::GetInitialLocale(); |
444 prefs->SetString(prefs::kApplicationLocale, locale); | 445 prefs->SetString(prefs::kApplicationLocale, locale); |
445 manager->EnableLayouts( | 446 manager->EnableLayouts( |
446 locale, | 447 locale, |
447 manager->GetInputMethodUtil()->GetHardwareInputMethodId()); | 448 manager->GetInputMethodUtil()->GetHardwareInputMethodId()); |
448 base::ThreadRestrictions::ScopedAllowIO allow_io; | 449 base::ThreadRestrictions::ScopedAllowIO allow_io; |
449 const std::string loaded_locale = | 450 const std::string loaded_locale = |
450 ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); | 451 ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); |
451 g_browser_process->SetApplicationLocale(loaded_locale); | 452 g_browser_process->SetApplicationLocale(loaded_locale); |
452 } | 453 } |
453 display_host->StartSignInScreen(); | 454 display_host->StartSignInScreen(); |
(...skipping 17 matching lines...) Expand all Loading... |
471 locale = startup_manifest->initial_locale(); | 472 locale = startup_manifest->initial_locale(); |
472 std::string layout = startup_manifest->keyboard_layout(); | 473 std::string layout = startup_manifest->keyboard_layout(); |
473 VLOG(1) << "Initial locale: " << locale | 474 VLOG(1) << "Initial locale: " << locale |
474 << "keyboard layout " << layout; | 475 << "keyboard layout " << layout; |
475 if (!locale.empty()) { | 476 if (!locale.empty()) { |
476 // Save initial locale from VPD/customization manifest as current | 477 // Save initial locale from VPD/customization manifest as current |
477 // Chrome locale. Otherwise it will be lost if Chrome restarts. | 478 // Chrome locale. Otherwise it will be lost if Chrome restarts. |
478 // Don't need to schedule pref save because setting initial local | 479 // Don't need to schedule pref save because setting initial local |
479 // will enforce preference saving. | 480 // will enforce preference saving. |
480 prefs->SetString(prefs::kApplicationLocale, locale); | 481 prefs->SetString(prefs::kApplicationLocale, locale); |
481 chromeos::WizardController::SetInitialLocale(locale); | 482 chromeos::StartupUtils::SetInitialLocale(locale); |
482 // Determine keyboard layout from OEM customization (if provided) or | 483 // Determine keyboard layout from OEM customization (if provided) or |
483 // initial locale and save it in preferences. | 484 // initial locale and save it in preferences. |
484 DetermineAndSaveHardwareKeyboard(locale, layout); | 485 DetermineAndSaveHardwareKeyboard(locale, layout); |
485 // Then, enable the hardware keyboard. | 486 // Then, enable the hardware keyboard. |
486 manager->EnableLayouts( | 487 manager->EnableLayouts( |
487 locale, | 488 locale, |
488 manager->GetInputMethodUtil()->GetHardwareInputMethodId()); | 489 manager->GetInputMethodUtil()->GetHardwareInputMethodId()); |
489 // Reloading resource bundle causes us to do blocking IO on UI thread. | 490 // Reloading resource bundle causes us to do blocking IO on UI thread. |
490 // Temporarily allow it until we fix http://crosbug.com/11102 | 491 // Temporarily allow it until we fix http://crosbug.com/11102 |
491 base::ThreadRestrictions::ScopedAllowIO allow_io; | 492 base::ThreadRestrictions::ScopedAllowIO allow_io; |
(...skipping 19 matching lines...) Expand all Loading... |
511 VLOG(1) << "Initial time zone: " << timezone_name; | 512 VLOG(1) << "Initial time zone: " << timezone_name; |
512 // Apply locale customizations only once to preserve whatever locale | 513 // Apply locale customizations only once to preserve whatever locale |
513 // user has changed to during OOBE. | 514 // user has changed to during OOBE. |
514 if (!timezone_name.empty()) { | 515 if (!timezone_name.empty()) { |
515 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 516 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
516 UTF8ToUTF16(timezone_name)); | 517 UTF8ToUTF16(timezone_name)); |
517 } | 518 } |
518 } | 519 } |
519 | 520 |
520 } // namespace chromeos | 521 } // namespace chromeos |
OLD | NEW |