| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/wizard_controller.h" | 5 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 25 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 26 #include "chrome/browser/chromeos/language_preferences.h" | 26 #include "chrome/browser/chromeos/language_preferences.h" |
| 27 #include "chrome/browser/chromeos/login/account_screen.h" | 27 #include "chrome/browser/chromeos/login/account_screen.h" |
| 28 #include "chrome/browser/chromeos/login/apply_services_customization.h" | 28 #include "chrome/browser/chromeos/login/apply_services_customization.h" |
| 29 #include "chrome/browser/chromeos/login/background_view.h" | 29 #include "chrome/browser/chromeos/login/background_view.h" |
| 30 #include "chrome/browser/chromeos/login/eula_view.h" | 30 #include "chrome/browser/chromeos/login/eula_view.h" |
| 31 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 31 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 32 #include "chrome/browser/chromeos/login/helper.h" | 32 #include "chrome/browser/chromeos/login/helper.h" |
| 33 #include "chrome/browser/chromeos/login/html_page_screen.h" | 33 #include "chrome/browser/chromeos/login/html_page_screen.h" |
| 34 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 34 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 35 #include "chrome/browser/chromeos/login/login_screen.h" | |
| 36 #include "chrome/browser/chromeos/login/login_utils.h" | 35 #include "chrome/browser/chromeos/login/login_utils.h" |
| 37 #include "chrome/browser/chromeos/login/network_screen.h" | 36 #include "chrome/browser/chromeos/login/network_screen.h" |
| 38 #include "chrome/browser/chromeos/login/registration_screen.h" | 37 #include "chrome/browser/chromeos/login/registration_screen.h" |
| 39 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 38 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| 40 #include "chrome/browser/chromeos/login/update_screen.h" | 39 #include "chrome/browser/chromeos/login/update_screen.h" |
| 41 #include "chrome/browser/chromeos/login/user_image_screen.h" | 40 #include "chrome/browser/chromeos/login/user_image_screen.h" |
| 42 #include "chrome/browser/chromeos/login/user_manager.h" | 41 #include "chrome/browser/chromeos/login/user_manager.h" |
| 43 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 42 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| 44 #include "chrome/browser/chromeos/wm_ipc.h" | 43 #include "chrome/browser/chromeos/wm_ipc.h" |
| 45 #include "chrome/browser/prefs/pref_service.h" | 44 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 background_widget_(NULL), | 255 background_widget_(NULL), |
| 257 background_view_(NULL), | 256 background_view_(NULL), |
| 258 contents_(NULL), | 257 contents_(NULL), |
| 259 current_screen_(NULL), | 258 current_screen_(NULL), |
| 260 #if defined(OFFICIAL_BUILD) | 259 #if defined(OFFICIAL_BUILD) |
| 261 is_official_build_(true), | 260 is_official_build_(true), |
| 262 #else | 261 #else |
| 263 is_official_build_(false), | 262 is_official_build_(false), |
| 264 #endif | 263 #endif |
| 265 is_out_of_box_(false), | 264 is_out_of_box_(false), |
| 266 is_test_mode_(false), | |
| 267 observer_(NULL) { | 265 observer_(NULL) { |
| 268 DCHECK(default_controller_ == NULL); | 266 DCHECK(default_controller_ == NULL); |
| 269 default_controller_ = this; | 267 default_controller_ = this; |
| 270 registrar_.Add( | 268 registrar_.Add( |
| 271 this, | 269 this, |
| 272 NotificationType::APP_TERMINATING, | 270 NotificationType::APP_TERMINATING, |
| 273 NotificationService::AllSources()); | 271 NotificationService::AllSources()); |
| 274 } | 272 } |
| 275 | 273 |
| 276 WizardController::~WizardController() { | 274 WizardController::~WizardController() { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 GetUpdateScreen()->CancelUpdate(); | 342 GetUpdateScreen()->CancelUpdate(); |
| 345 } | 343 } |
| 346 } | 344 } |
| 347 | 345 |
| 348 chromeos::NetworkScreen* WizardController::GetNetworkScreen() { | 346 chromeos::NetworkScreen* WizardController::GetNetworkScreen() { |
| 349 if (!network_screen_.get()) | 347 if (!network_screen_.get()) |
| 350 network_screen_.reset(new chromeos::NetworkScreen(this)); | 348 network_screen_.reset(new chromeos::NetworkScreen(this)); |
| 351 return network_screen_.get(); | 349 return network_screen_.get(); |
| 352 } | 350 } |
| 353 | 351 |
| 354 chromeos::LoginScreen* WizardController::GetLoginScreen() { | |
| 355 if (!login_screen_.get()) | |
| 356 login_screen_.reset(new chromeos::LoginScreen(this)); | |
| 357 return login_screen_.get(); | |
| 358 } | |
| 359 | |
| 360 chromeos::AccountScreen* WizardController::GetAccountScreen() { | 352 chromeos::AccountScreen* WizardController::GetAccountScreen() { |
| 361 if (!account_screen_.get()) | 353 if (!account_screen_.get()) |
| 362 account_screen_.reset(new chromeos::AccountScreen(this)); | 354 account_screen_.reset(new chromeos::AccountScreen(this)); |
| 363 return account_screen_.get(); | 355 return account_screen_.get(); |
| 364 } | 356 } |
| 365 | 357 |
| 366 chromeos::UpdateScreen* WizardController::GetUpdateScreen() { | 358 chromeos::UpdateScreen* WizardController::GetUpdateScreen() { |
| 367 if (!update_screen_.get()) { | 359 if (!update_screen_.get()) { |
| 368 update_screen_.reset(new chromeos::UpdateScreen(this)); | 360 update_screen_.reset(new chromeos::UpdateScreen(this)); |
| 369 update_screen_->SetRebootCheckDelay(kWaitForRebootTimeSec); | 361 update_screen_->SetRebootCheckDelay(kWaitForRebootTimeSec); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 background_view_->SetOobeProgress(chromeos::BackgroundView::SELECT_NETWORK); | 404 background_view_->SetOobeProgress(chromeos::BackgroundView::SELECT_NETWORK); |
| 413 } | 405 } |
| 414 | 406 |
| 415 chromeos::ExistingUserController* WizardController::ShowLoginScreen() { | 407 chromeos::ExistingUserController* WizardController::ShowLoginScreen() { |
| 416 SetStatusAreaVisible(true); | 408 SetStatusAreaVisible(true); |
| 417 background_view_->SetOobeProgress(chromeos::BackgroundView::SIGNIN); | 409 background_view_->SetOobeProgress(chromeos::BackgroundView::SIGNIN); |
| 418 | 410 |
| 419 // Initiate services customization. | 411 // Initiate services customization. |
| 420 chromeos::ApplyServicesCustomization::StartIfNeeded(); | 412 chromeos::ApplyServicesCustomization::StartIfNeeded(); |
| 421 | 413 |
| 422 // When run under automation test show plain login screen. | 414 std::vector<chromeos::UserManager::User> users; |
| 423 if (!is_test_mode_ && | 415 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) |
| 424 chromeos::CrosLibrary::Get()->EnsureLoaded() && | 416 users = chromeos::UserManager::Get()->GetUsers(); |
| 425 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 426 switches::kEnableLoginImages)) { | |
| 427 std::vector<chromeos::UserManager::User> users = | |
| 428 chromeos::UserManager::Get()->GetUsers(); | |
| 429 // ExistingUserController deletes itself. | |
| 430 gfx::Rect screen_bounds; | |
| 431 background_widget_->GetBounds(&screen_bounds, true); | |
| 432 chromeos::ExistingUserController* controller = | |
| 433 new chromeos::ExistingUserController(users, screen_bounds); | |
| 434 controller->OwnBackground(background_widget_, background_view_); | |
| 435 controller->Init(); | |
| 436 background_widget_ = NULL; | |
| 437 background_view_ = NULL; | |
| 438 | 417 |
| 439 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 418 // ExistingUserController deletes itself. |
| 419 gfx::Rect screen_bounds; |
| 420 background_widget_->GetBounds(&screen_bounds, true); |
| 421 chromeos::ExistingUserController* controller = |
| 422 new chromeos::ExistingUserController(users, screen_bounds); |
| 423 controller->OwnBackground(background_widget_, background_view_); |
| 424 controller->Init(); |
| 425 background_widget_ = NULL; |
| 426 background_view_ = NULL; |
| 440 | 427 |
| 441 return controller; | 428 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 442 } | |
| 443 | 429 |
| 444 SetCurrentScreen(GetLoginScreen()); | 430 return controller; |
| 445 return NULL; | |
| 446 } | 431 } |
| 447 | 432 |
| 448 void WizardController::ShowAccountScreen() { | 433 void WizardController::ShowAccountScreen() { |
| 449 VLOG(1) << "Showing create account screen."; | 434 VLOG(1) << "Showing create account screen."; |
| 450 SetStatusAreaVisible(true); | 435 SetStatusAreaVisible(true); |
| 451 SetCurrentScreen(GetAccountScreen()); | 436 SetCurrentScreen(GetAccountScreen()); |
| 452 } | 437 } |
| 453 | 438 |
| 454 void WizardController::ShowUpdateScreen() { | 439 void WizardController::ShowUpdateScreen() { |
| 455 VLOG(1) << "Showing update screen."; | 440 VLOG(1) << "Showing update screen."; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 local_state->RegisterBooleanPref(kEulaAccepted, false); | 522 local_state->RegisterBooleanPref(kEulaAccepted, false); |
| 538 // Check if the pref is already registered in case | 523 // Check if the pref is already registered in case |
| 539 // Preferences::RegisterUserPrefs runs before this code in the future. | 524 // Preferences::RegisterUserPrefs runs before this code in the future. |
| 540 if (local_state->FindPreference(prefs::kAccessibilityEnabled) == NULL) { | 525 if (local_state->FindPreference(prefs::kAccessibilityEnabled) == NULL) { |
| 541 local_state->RegisterBooleanPref(prefs::kAccessibilityEnabled, false); | 526 local_state->RegisterBooleanPref(prefs::kAccessibilityEnabled, false); |
| 542 } | 527 } |
| 543 } | 528 } |
| 544 | 529 |
| 545 /////////////////////////////////////////////////////////////////////////////// | 530 /////////////////////////////////////////////////////////////////////////////// |
| 546 // WizardController, ExitHandlers: | 531 // WizardController, ExitHandlers: |
| 547 void WizardController::OnLoginSignInSelected() { | |
| 548 // Don't show user image screen in case of automated testing. | |
| 549 if (is_test_mode_) { | |
| 550 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | |
| 551 return; | |
| 552 } | |
| 553 // Don't launch browser until we pass image screen. | |
| 554 chromeos::LoginUtils::Get()->EnableBrowserLaunch(false); | |
| 555 ShowUserImageScreen(); | |
| 556 } | |
| 557 | |
| 558 void WizardController::OnLoginGuestUser() { | |
| 559 // We're on the stack, so don't try and delete us now. | |
| 560 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | |
| 561 } | |
| 562 | |
| 563 void WizardController::OnLoginCreateAccount() { | |
| 564 ShowAccountScreen(); | |
| 565 } | |
| 566 | |
| 567 void WizardController::OnNetworkConnected() { | 532 void WizardController::OnNetworkConnected() { |
| 568 if (is_official_build_) { | 533 if (is_official_build_) { |
| 569 if (!IsEulaAccepted()) { | 534 if (!IsEulaAccepted()) { |
| 570 ShowEulaScreen(); | 535 ShowEulaScreen(); |
| 571 } else { | 536 } else { |
| 572 // Possible cases: | 537 // Possible cases: |
| 573 // 1. EULA was accepted, forced shutdown/reboot during update. | 538 // 1. EULA was accepted, forced shutdown/reboot during update. |
| 574 // 2. EULA was accepted, planned reboot after update. | 539 // 2. EULA was accepted, planned reboot after update. |
| 575 // Make sure that device is up-to-date. | 540 // Make sure that device is up-to-date. |
| 576 InitiateOOBEUpdate(); | 541 InitiateOOBEUpdate(); |
| 577 } | 542 } |
| 578 } else { | 543 } else { |
| 579 InitiateOOBEUpdate(); | 544 InitiateOOBEUpdate(); |
| 580 } | 545 } |
| 581 } | 546 } |
| 582 | 547 |
| 583 void WizardController::OnNetworkOffline() { | 548 void WizardController::OnNetworkOffline() { |
| 584 // TODO(dpolukhin): if(is_out_of_box_) we cannot work offline and | 549 // TODO(dpolukhin): if(is_out_of_box_) we cannot work offline and |
| 585 // should report some error message here and stay on the same screen. | 550 // should report some error message here and stay on the same screen. |
| 586 ShowLoginScreen(); | 551 ShowLoginScreen(); |
| 587 } | 552 } |
| 588 | 553 |
| 589 void WizardController::OnAccountCreateBack() { | 554 void WizardController::OnAccountCreateBack() { |
| 590 chromeos::ExistingUserController* controller = ShowLoginScreen(); | 555 chromeos::ExistingUserController* controller = ShowLoginScreen(); |
| 591 if (controller) | 556 DCHECK(controller); |
| 592 controller->SelectNewUser(); | 557 controller->SelectNewUser(); |
| 593 } | 558 } |
| 594 | 559 |
| 595 void WizardController::OnAccountCreated() { | 560 void WizardController::OnAccountCreated() { |
| 596 chromeos::ExistingUserController* controller = ShowLoginScreen(); | 561 chromeos::ExistingUserController* controller = ShowLoginScreen(); |
| 597 if (controller) | 562 DCHECK(controller); |
| 598 controller->LoginNewUser(username_, password_); | 563 controller->LoginNewUser(username_, password_); |
| 599 else | |
| 600 Login(username_, password_); | |
| 601 // TODO(dpolukhin): clear password memory for real. Now it is not | 564 // TODO(dpolukhin): clear password memory for real. Now it is not |
| 602 // a problem because we can't extract password from the form. | 565 // a problem because we can't extract password from the form. |
| 603 password_.clear(); | 566 password_.clear(); |
| 604 } | 567 } |
| 605 | 568 |
| 606 void WizardController::OnConnectionFailed() { | 569 void WizardController::OnConnectionFailed() { |
| 607 // TODO(dpolukhin): show error message after login screen is displayed. | 570 // TODO(dpolukhin): show error message after login screen is displayed. |
| 608 ShowLoginScreen(); | 571 ShowLoginScreen(); |
| 609 } | 572 } |
| 610 | 573 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 // to WizardController it happens after screen is shown. | 723 // to WizardController it happens after screen is shown. |
| 761 if (background_view_) { | 724 if (background_view_) { |
| 762 background_view_->SetStatusAreaVisible(visible); | 725 background_view_->SetStatusAreaVisible(visible); |
| 763 } | 726 } |
| 764 } | 727 } |
| 765 | 728 |
| 766 void WizardController::ShowFirstScreen(const std::string& first_screen_name) { | 729 void WizardController::ShowFirstScreen(const std::string& first_screen_name) { |
| 767 if (first_screen_name == kNetworkScreenName) { | 730 if (first_screen_name == kNetworkScreenName) { |
| 768 ShowNetworkScreen(); | 731 ShowNetworkScreen(); |
| 769 } else if (first_screen_name == kLoginScreenName) { | 732 } else if (first_screen_name == kLoginScreenName) { |
| 770 // This flag is passed if we're running under automation test. | |
| 771 is_test_mode_ = true; | |
| 772 ShowLoginScreen(); | 733 ShowLoginScreen(); |
| 773 } else if (first_screen_name == kAccountScreenName) { | 734 } else if (first_screen_name == kAccountScreenName) { |
| 774 ShowAccountScreen(); | 735 ShowAccountScreen(); |
| 775 } else if (first_screen_name == kUpdateScreenName) { | 736 } else if (first_screen_name == kUpdateScreenName) { |
| 776 InitiateOOBEUpdate(); | 737 InitiateOOBEUpdate(); |
| 777 } else if (first_screen_name == kUserImageScreenName) { | 738 } else if (first_screen_name == kUserImageScreenName) { |
| 778 ShowUserImageScreen(); | 739 ShowUserImageScreen(); |
| 779 } else if (first_screen_name == kEulaScreenName) { | 740 } else if (first_screen_name == kEulaScreenName) { |
| 780 ShowEulaScreen(); | 741 ShowEulaScreen(); |
| 781 } else if (first_screen_name == kRegistrationScreenName) { | 742 } else if (first_screen_name == kRegistrationScreenName) { |
| 782 if (is_official_build_) { | 743 if (is_official_build_) { |
| 783 ShowRegistrationScreen(); | 744 ShowRegistrationScreen(); |
| 784 } else { | 745 } else { |
| 785 // Just proceed to image screen. | 746 // Just proceed to image screen. |
| 786 OnRegistrationSuccess(); | 747 OnRegistrationSuccess(); |
| 787 } | 748 } |
| 788 } else if (first_screen_name == kHTMLPageScreenName) { | 749 } else if (first_screen_name == kHTMLPageScreenName) { |
| 789 ShowHTMLPageScreen(); | 750 ShowHTMLPageScreen(); |
| 790 } else if (first_screen_name != kTestNoScreenName) { | 751 } else if (first_screen_name != kTestNoScreenName) { |
| 791 if (is_out_of_box_) { | 752 if (is_out_of_box_) { |
| 792 ShowNetworkScreen(); | 753 ShowNetworkScreen(); |
| 793 } else { | 754 } else { |
| 794 ShowLoginScreen(); | 755 ShowLoginScreen(); |
| 795 } | 756 } |
| 796 } | 757 } |
| 797 } | 758 } |
| 798 | 759 |
| 799 void WizardController::Login(const std::string& username, | |
| 800 const std::string& password) { | |
| 801 chromeos::LoginScreen* login = GetLoginScreen(); | |
| 802 if (username.empty()) | |
| 803 return; | |
| 804 login->view()->SetUsername(username); | |
| 805 | |
| 806 if (password.empty()) | |
| 807 return; | |
| 808 login->view()->SetPassword(password); | |
| 809 login->view()->Login(); | |
| 810 } | |
| 811 | |
| 812 // static | 760 // static |
| 813 bool WizardController::IsEulaAccepted() { | 761 bool WizardController::IsEulaAccepted() { |
| 814 return g_browser_process->local_state()->GetBoolean(kEulaAccepted); | 762 return g_browser_process->local_state()->GetBoolean(kEulaAccepted); |
| 815 } | 763 } |
| 816 | 764 |
| 817 // static | 765 // static |
| 818 bool WizardController::IsOobeCompleted() { | 766 bool WizardController::IsOobeCompleted() { |
| 819 return g_browser_process->local_state()->GetBoolean(kOobeComplete); | 767 return g_browser_process->local_state()->GetBoolean(kOobeComplete); |
| 820 } | 768 } |
| 821 | 769 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 851 } | 799 } |
| 852 | 800 |
| 853 // static | 801 // static |
| 854 void WizardController::MarkDeviceRegistered() { | 802 void WizardController::MarkDeviceRegistered() { |
| 855 // Creating flag file causes us to do blocking IO on UI thread. | 803 // Creating flag file causes us to do blocking IO on UI thread. |
| 856 // Temporarily allow it until we fix http://crbug.com/70131 | 804 // Temporarily allow it until we fix http://crbug.com/70131 |
| 857 base::ThreadRestrictions::ScopedAllowIO allow_io; | 805 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 858 // Create flag file for boot-time init scripts. | 806 // Create flag file for boot-time init scripts. |
| 859 FilePath oobe_complete_path(kOobeCompleteFlagFilePath); | 807 FilePath oobe_complete_path(kOobeCompleteFlagFilePath); |
| 860 FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b"); | 808 FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b"); |
| 861 DCHECK(oobe_flag_file != NULL) << kOobeCompleteFlagFilePath; | 809 if (oobe_flag_file == NULL) |
| 862 if (oobe_flag_file != NULL) | 810 DLOG(WARNING) << kOobeCompleteFlagFilePath << " doesn't exist."; |
| 811 else |
| 863 file_util::CloseFile(oobe_flag_file); | 812 file_util::CloseFile(oobe_flag_file); |
| 864 } | 813 } |
| 865 | 814 |
| 866 /////////////////////////////////////////////////////////////////////////////// | 815 /////////////////////////////////////////////////////////////////////////////// |
| 867 // WizardController, chromeos::ScreenObserver overrides: | 816 // WizardController, chromeos::ScreenObserver overrides: |
| 868 void WizardController::OnExit(ExitCodes exit_code) { | 817 void WizardController::OnExit(ExitCodes exit_code) { |
| 869 LOG(INFO) << "Wizard screen exit code: " << exit_code; | 818 LOG(INFO) << "Wizard screen exit code: " << exit_code; |
| 870 switch (exit_code) { | 819 switch (exit_code) { |
| 871 case LOGIN_SIGN_IN_SELECTED: | |
| 872 OnLoginSignInSelected(); | |
| 873 break; | |
| 874 case LOGIN_GUEST_SELECTED: | |
| 875 OnLoginGuestUser(); | |
| 876 break; | |
| 877 case LOGIN_CREATE_ACCOUNT: | |
| 878 OnLoginCreateAccount(); | |
| 879 break; | |
| 880 case NETWORK_CONNECTED: | 820 case NETWORK_CONNECTED: |
| 881 OnNetworkConnected(); | 821 OnNetworkConnected(); |
| 882 break; | 822 break; |
| 883 case NETWORK_OFFLINE: | 823 case NETWORK_OFFLINE: |
| 884 OnNetworkOffline(); | 824 OnNetworkOffline(); |
| 885 break; | 825 break; |
| 886 case ACCOUNT_CREATE_BACK: | 826 case ACCOUNT_CREATE_BACK: |
| 887 OnAccountCreateBack(); | 827 OnAccountCreateBack(); |
| 888 break; | 828 break; |
| 889 case ACCOUNT_CREATED: | 829 case ACCOUNT_CREATED: |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 chromeos::language_prefs::kPreferredKeyboardLayout); | 904 chromeos::language_prefs::kPreferredKeyboardLayout); |
| 965 chromeos::input_method::EnableInputMethods( | 905 chromeos::input_method::EnableInputMethods( |
| 966 locale, chromeos::input_method::kKeyboardLayoutsOnly, | 906 locale, chromeos::input_method::kKeyboardLayoutsOnly, |
| 967 initial_input_method_id); | 907 initial_input_method_id); |
| 968 } | 908 } |
| 969 | 909 |
| 970 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(size)); | 910 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(size)); |
| 971 | 911 |
| 972 // Check whether we need to execute OOBE process. | 912 // Check whether we need to execute OOBE process. |
| 973 bool oobe_complete = WizardController::IsOobeCompleted(); | 913 bool oobe_complete = WizardController::IsOobeCompleted(); |
| 914 bool show_login_screen = |
| 915 (first_screen_name.empty() && oobe_complete) || |
| 916 first_screen_name == WizardController::kLoginScreenName; |
| 974 | 917 |
| 975 if (first_screen_name.empty() && | 918 if (show_login_screen && chromeos::CrosLibrary::Get()->EnsureLoaded()) { |
| 976 oobe_complete && | |
| 977 chromeos::CrosLibrary::Get()->EnsureLoaded() && | |
| 978 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 979 switches::kEnableLoginImages)) { | |
| 980 std::vector<chromeos::UserManager::User> users = | 919 std::vector<chromeos::UserManager::User> users = |
| 981 chromeos::UserManager::Get()->GetUsers(); | 920 chromeos::UserManager::Get()->GetUsers(); |
| 982 | 921 |
| 983 // Fix for users who updated device and thus never passed register screen. | 922 // Fix for users who updated device and thus never passed register screen. |
| 984 // If we already have user we assume that it is not a second part of OOBE. | 923 // If we already have users, we assume that it is not a second part of |
| 985 // See http://crosbug.com/6289 | 924 // OOBE. See http://crosbug.com/6289 |
| 986 if (!WizardController::IsDeviceRegistered() && !users.empty()) { | 925 if (!WizardController::IsDeviceRegistered() && !users.empty()) { |
| 987 VLOG(1) << "Mark device registered because there are remembered users: " | 926 VLOG(1) << "Mark device registered because there are remembered users: " |
| 988 << users.size(); | 927 << users.size(); |
| 989 WizardController::MarkDeviceRegistered(); | 928 WizardController::MarkDeviceRegistered(); |
| 990 } | 929 } |
| 991 | 930 |
| 992 // ExistingUserController deletes itself. | 931 // ExistingUserController deletes itself. |
| 993 (new chromeos::ExistingUserController(users, screen_bounds))->Init(); | 932 (new chromeos::ExistingUserController(users, screen_bounds))->Init(); |
| 994 | 933 |
| 995 // Initiate services customization. | 934 // Initiate services customization. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 // user has changed to during OOBE. | 988 // user has changed to during OOBE. |
| 1050 if (!timezone_name.empty()) { | 989 if (!timezone_name.empty()) { |
| 1051 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( | 990 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( |
| 1052 icu::UnicodeString::fromUTF8(timezone_name)); | 991 icu::UnicodeString::fromUTF8(timezone_name)); |
| 1053 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); | 992 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); |
| 1054 } | 993 } |
| 1055 } | 994 } |
| 1056 } | 995 } |
| 1057 | 996 |
| 1058 } // namespace browser | 997 } // namespace browser |
| OLD | NEW |