Chromium Code Reviews| 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/wizard_controller.h" | 5 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/chromeos/cros/cros_library.h" | 23 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 24 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 24 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
| 25 #include "chrome/browser/chromeos/customization_document.h" | 25 #include "chrome/browser/chromeos/customization_document.h" |
| 26 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen. h" | 26 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen. h" |
| 27 #include "chrome/browser/chromeos/login/eula_screen.h" | 27 #include "chrome/browser/chromeos/login/eula_screen.h" |
| 28 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 28 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 29 #include "chrome/browser/chromeos/login/helper.h" | 29 #include "chrome/browser/chromeos/login/helper.h" |
| 30 #include "chrome/browser/chromeos/login/html_page_screen.h" | 30 #include "chrome/browser/chromeos/login/html_page_screen.h" |
| 31 #include "chrome/browser/chromeos/login/hwid_checker.h" | |
| 31 #include "chrome/browser/chromeos/login/login_display_host.h" | 32 #include "chrome/browser/chromeos/login/login_display_host.h" |
| 32 #include "chrome/browser/chromeos/login/login_utils.h" | 33 #include "chrome/browser/chromeos/login/login_utils.h" |
| 33 #include "chrome/browser/chromeos/login/network_screen.h" | 34 #include "chrome/browser/chromeos/login/network_screen.h" |
| 34 #include "chrome/browser/chromeos/login/oobe_display.h" | 35 #include "chrome/browser/chromeos/login/oobe_display.h" |
| 35 #include "chrome/browser/chromeos/login/registration_screen.h" | 36 #include "chrome/browser/chromeos/login/registration_screen.h" |
| 36 #include "chrome/browser/chromeos/login/reset_screen.h" | 37 #include "chrome/browser/chromeos/login/reset_screen.h" |
| 37 #include "chrome/browser/chromeos/login/update_screen.h" | 38 #include "chrome/browser/chromeos/login/update_screen.h" |
| 38 #include "chrome/browser/chromeos/login/user_image_screen.h" | 39 #include "chrome/browser/chromeos/login/user_image_screen.h" |
| 39 #include "chrome/browser/chromeos/login/user_manager.h" | 40 #include "chrome/browser/chromeos/login/user_manager.h" |
| 41 #include "chrome/browser/chromeos/login/wrong_hwid_screen.h" | |
| 40 #include "chrome/browser/chromeos/settings/cros_settings.h" | 42 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 41 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 43 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| 42 #include "chrome/browser/prefs/pref_registry_simple.h" | 44 #include "chrome/browser/prefs/pref_registry_simple.h" |
| 43 #include "chrome/browser/prefs/pref_service.h" | 45 #include "chrome/browser/prefs/pref_service.h" |
| 44 #include "chrome/browser/profiles/profile_manager.h" | 46 #include "chrome/browser/profiles/profile_manager.h" |
| 45 #include "chrome/browser/ui/options/options_util.h" | 47 #include "chrome/browser/ui/options/options_util.h" |
| 46 #include "chrome/common/chrome_notification_types.h" | 48 #include "chrome/common/chrome_notification_types.h" |
| 47 #include "chrome/common/pref_names.h" | 49 #include "chrome/common/pref_names.h" |
| 48 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
| 49 #include "content/public/browser/notification_service.h" | 51 #include "content/public/browser/notification_service.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 | 109 |
| 108 const char WizardController::kNetworkScreenName[] = "network"; | 110 const char WizardController::kNetworkScreenName[] = "network"; |
| 109 const char WizardController::kLoginScreenName[] = "login"; | 111 const char WizardController::kLoginScreenName[] = "login"; |
| 110 const char WizardController::kUpdateScreenName[] = "update"; | 112 const char WizardController::kUpdateScreenName[] = "update"; |
| 111 const char WizardController::kUserImageScreenName[] = "image"; | 113 const char WizardController::kUserImageScreenName[] = "image"; |
| 112 const char WizardController::kEulaScreenName[] = "eula"; | 114 const char WizardController::kEulaScreenName[] = "eula"; |
| 113 const char WizardController::kRegistrationScreenName[] = "register"; | 115 const char WizardController::kRegistrationScreenName[] = "register"; |
| 114 const char WizardController::kHTMLPageScreenName[] = "html"; | 116 const char WizardController::kHTMLPageScreenName[] = "html"; |
| 115 const char WizardController::kEnterpriseEnrollmentScreenName[] = "enroll"; | 117 const char WizardController::kEnterpriseEnrollmentScreenName[] = "enroll"; |
| 116 const char WizardController::kResetScreenName[] = "reset"; | 118 const char WizardController::kResetScreenName[] = "reset"; |
| 119 const char WizardController::kWrongHWIDScreenName[] = "wrong-hwid"; | |
| 117 | 120 |
| 118 // Passing this parameter as a "first screen" initiates full OOBE flow. | 121 // Passing this parameter as a "first screen" initiates full OOBE flow. |
| 119 const char WizardController::kOutOfBoxScreenName[] = "oobe"; | 122 const char WizardController::kOutOfBoxScreenName[] = "oobe"; |
| 120 | 123 |
| 121 // Special test value that commands not to create any window yet. | 124 // Special test value that commands not to create any window yet. |
| 122 const char WizardController::kTestNoScreenName[] = "test:nowindow"; | 125 const char WizardController::kTestNoScreenName[] = "test:nowindow"; |
| 123 | 126 |
| 124 // Initialize default controller. | 127 // Initialize default controller. |
| 125 // static | 128 // static |
| 126 WizardController* WizardController::default_controller_ = NULL; | 129 WizardController* WizardController::default_controller_ = NULL; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 bool oobe_complete = IsOobeCompleted(); | 173 bool oobe_complete = IsOobeCompleted(); |
| 171 if (!oobe_complete || first_screen_name == kOutOfBoxScreenName) { | 174 if (!oobe_complete || first_screen_name == kOutOfBoxScreenName) { |
| 172 is_out_of_box_ = true; | 175 is_out_of_box_ = true; |
| 173 } | 176 } |
| 174 | 177 |
| 175 AdvanceToScreen(first_screen_name); | 178 AdvanceToScreen(first_screen_name); |
| 176 content::NotificationService::current()->Notify( | 179 content::NotificationService::current()->Notify( |
| 177 chrome::NOTIFICATION_WIZARD_FIRST_SCREEN_SHOWN, | 180 chrome::NOTIFICATION_WIZARD_FIRST_SCREEN_SHOWN, |
| 178 content::NotificationService::AllSources(), | 181 content::NotificationService::AllSources(), |
| 179 content::NotificationService::NoDetails()); | 182 content::NotificationService::NoDetails()); |
| 183 if (!IsMachineHWIDCorrect() && !IsDeviceRegistered() && | |
| 184 first_screen_name.empty()) | |
| 185 ShowWrongHWIDScreen(); | |
|
Nikita (slow)
2013/02/11 17:09:03
nit: Add {}
You could also move this above and pl
dzhioev (left Google)
2013/02/11 23:32:56
I am not sure that it will be correct. We want to
Nikita (slow)
2013/02/12 07:51:50
I see, yes that makes sense to open first screen b
| |
| 180 } | 186 } |
| 181 | 187 |
| 182 chromeos::NetworkScreen* WizardController::GetNetworkScreen() { | 188 chromeos::NetworkScreen* WizardController::GetNetworkScreen() { |
| 183 if (!network_screen_.get()) | 189 if (!network_screen_.get()) |
| 184 network_screen_.reset(new chromeos::NetworkScreen( | 190 network_screen_.reset(new chromeos::NetworkScreen( |
| 185 this, oobe_display_->GetNetworkScreenActor())); | 191 this, oobe_display_->GetNetworkScreenActor())); |
| 186 return network_screen_.get(); | 192 return network_screen_.get(); |
| 187 } | 193 } |
| 188 | 194 |
| 189 chromeos::UpdateScreen* WizardController::GetUpdateScreen() { | 195 chromeos::UpdateScreen* WizardController::GetUpdateScreen() { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 } | 256 } |
| 251 | 257 |
| 252 chromeos::ResetScreen* WizardController::GetResetScreen() { | 258 chromeos::ResetScreen* WizardController::GetResetScreen() { |
| 253 if (!reset_screen_.get()) { | 259 if (!reset_screen_.get()) { |
| 254 reset_screen_.reset( | 260 reset_screen_.reset( |
| 255 new chromeos::ResetScreen(this, oobe_display_->GetResetScreenActor())); | 261 new chromeos::ResetScreen(this, oobe_display_->GetResetScreenActor())); |
| 256 } | 262 } |
| 257 return reset_screen_.get(); | 263 return reset_screen_.get(); |
| 258 } | 264 } |
| 259 | 265 |
| 266 chromeos::WrongHWIDScreen* WizardController::GetWrongHWIDScreen() { | |
| 267 if (!wrong_hwid_screen_.get()) { | |
| 268 wrong_hwid_screen_.reset( | |
| 269 new chromeos::WrongHWIDScreen( | |
| 270 this, oobe_display_->GetWrongHWIDScreenActor())); | |
| 271 } | |
| 272 return wrong_hwid_screen_.get(); | |
| 273 } | |
| 274 | |
| 260 void WizardController::ShowNetworkScreen() { | 275 void WizardController::ShowNetworkScreen() { |
| 261 VLOG(1) << "Showing network screen."; | 276 VLOG(1) << "Showing network screen."; |
| 262 SetStatusAreaVisible(false); | 277 SetStatusAreaVisible(false); |
| 263 SetCurrentScreen(GetNetworkScreen()); | 278 SetCurrentScreen(GetNetworkScreen()); |
| 264 } | 279 } |
| 265 | 280 |
| 266 void WizardController::ShowLoginScreen() { | 281 void WizardController::ShowLoginScreen() { |
| 267 if (!time_eula_accepted_.is_null()) { | 282 if (!time_eula_accepted_.is_null()) { |
| 268 base::TimeDelta delta = base::Time::Now() - time_eula_accepted_; | 283 base::TimeDelta delta = base::Time::Now() - time_eula_accepted_; |
| 269 UMA_HISTOGRAM_MEDIUM_TIMES("OOBE.EULAToSignInTime", delta); | 284 UMA_HISTOGRAM_MEDIUM_TIMES("OOBE.EULAToSignInTime", delta); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 screen->SetParameters(is_auto_enrollment, user); | 359 screen->SetParameters(is_auto_enrollment, user); |
| 345 SetCurrentScreen(screen); | 360 SetCurrentScreen(screen); |
| 346 } | 361 } |
| 347 | 362 |
| 348 void WizardController::ShowResetScreen() { | 363 void WizardController::ShowResetScreen() { |
| 349 VLOG(1) << "Showing reset screen."; | 364 VLOG(1) << "Showing reset screen."; |
| 350 SetStatusAreaVisible(false); | 365 SetStatusAreaVisible(false); |
| 351 SetCurrentScreen(GetResetScreen()); | 366 SetCurrentScreen(GetResetScreen()); |
| 352 } | 367 } |
| 353 | 368 |
| 369 void WizardController::ShowWrongHWIDScreen() { | |
| 370 VLOG(1) << "Showing wrong HWID screen."; | |
| 371 SetStatusAreaVisible(false); | |
| 372 SetCurrentScreen(GetWrongHWIDScreen()); | |
| 373 } | |
| 374 | |
| 354 void WizardController::SkipToLoginForTesting() { | 375 void WizardController::SkipToLoginForTesting() { |
| 355 MarkEulaAccepted(); | 376 MarkEulaAccepted(); |
| 356 PerformPostEulaActions(); | 377 PerformPostEulaActions(); |
| 357 PerformPostUpdateActions(); | 378 PerformPostUpdateActions(); |
| 358 ShowLoginScreen(); | 379 ShowLoginScreen(); |
| 359 } | 380 } |
| 360 | 381 |
| 361 void WizardController::SkipImageSelectionForTesting() { | 382 void WizardController::SkipImageSelectionForTesting() { |
| 362 skip_user_image_selection_ = true; | 383 skip_user_image_selection_ = true; |
| 363 } | 384 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 521 ShowLoginScreen(); | 542 ShowLoginScreen(); |
| 522 } | 543 } |
| 523 | 544 |
| 524 void WizardController::OnResetCanceled() { | 545 void WizardController::OnResetCanceled() { |
| 525 if (previous_screen_) | 546 if (previous_screen_) |
| 526 SetCurrentScreen(previous_screen_); | 547 SetCurrentScreen(previous_screen_); |
| 527 else | 548 else |
| 528 ShowLoginScreen(); | 549 ShowLoginScreen(); |
| 529 } | 550 } |
| 530 | 551 |
| 552 void WizardController::OnWrongHWIDWarningSkipped() { | |
| 553 if (IsOobeCompleted()) { | |
| 554 ShowLoginScreen(); | |
|
Nikita (slow)
2013/02/11 17:09:03
nit: Drop {}
dzhioev (left Google)
2013/02/11 23:32:56
It seems like code is incorrect here. I'll check i
Nikita (slow)
2013/02/12 07:51:50
Do you mean that it has to use previous_screen_ he
dzhioev (left Google)
2013/02/12 13:57:51
Yes, I do. I think code shoud be same as in Wizard
| |
| 555 } else { | |
| 556 ShowNetworkScreen(); | |
| 557 } | |
| 558 } | |
| 559 | |
| 531 void WizardController::OnEnterpriseAutoEnrollmentDone() { | 560 void WizardController::OnEnterpriseAutoEnrollmentDone() { |
| 532 VLOG(1) << "Automagic enrollment done, resuming previous signin"; | 561 VLOG(1) << "Automagic enrollment done, resuming previous signin"; |
| 533 ResumeLoginScreen(); | 562 ResumeLoginScreen(); |
| 534 } | 563 } |
| 535 | 564 |
| 536 void WizardController::OnOOBECompleted() { | 565 void WizardController::OnOOBECompleted() { |
| 537 PerformPostUpdateActions(); | 566 PerformPostUpdateActions(); |
| 538 ShowLoginScreen(); | 567 ShowLoginScreen(); |
| 539 } | 568 } |
| 540 | 569 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 621 } else { | 650 } else { |
| 622 // Just proceed to image screen. | 651 // Just proceed to image screen. |
| 623 OnRegistrationSuccess(); | 652 OnRegistrationSuccess(); |
| 624 } | 653 } |
| 625 } else if (screen_name == kResetScreenName) { | 654 } else if (screen_name == kResetScreenName) { |
| 626 ShowResetScreen(); | 655 ShowResetScreen(); |
| 627 } else if (screen_name == kHTMLPageScreenName) { | 656 } else if (screen_name == kHTMLPageScreenName) { |
| 628 ShowHTMLPageScreen(); | 657 ShowHTMLPageScreen(); |
| 629 } else if (screen_name == kEnterpriseEnrollmentScreenName) { | 658 } else if (screen_name == kEnterpriseEnrollmentScreenName) { |
| 630 ShowEnterpriseEnrollmentScreen(); | 659 ShowEnterpriseEnrollmentScreen(); |
| 660 } else if (screen_name == kWrongHWIDScreenName) { | |
| 661 ShowWrongHWIDScreen(); | |
| 631 } else if (screen_name != kTestNoScreenName) { | 662 } else if (screen_name != kTestNoScreenName) { |
| 632 if (is_out_of_box_) { | 663 if (is_out_of_box_) { |
| 633 ShowNetworkScreen(); | 664 ShowNetworkScreen(); |
| 634 } else { | 665 } else { |
| 635 ShowLoginScreen(); | 666 ShowLoginScreen(); |
| 636 } | 667 } |
| 637 } | 668 } |
| 638 } | 669 } |
| 639 | 670 |
| 640 // static | 671 // static |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 break; | 814 break; |
| 784 case ENTERPRISE_ENROLLMENT_COMPLETED: | 815 case ENTERPRISE_ENROLLMENT_COMPLETED: |
| 785 OnEnterpriseEnrollmentDone(); | 816 OnEnterpriseEnrollmentDone(); |
| 786 break; | 817 break; |
| 787 case RESET_CANCELED: | 818 case RESET_CANCELED: |
| 788 OnResetCanceled(); | 819 OnResetCanceled(); |
| 789 break; | 820 break; |
| 790 case ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED: | 821 case ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED: |
| 791 OnEnterpriseAutoEnrollmentDone(); | 822 OnEnterpriseAutoEnrollmentDone(); |
| 792 break; | 823 break; |
| 824 case WRONG_HWID_WARNING_SKIPPED: | |
| 825 OnWrongHWIDWarningSkipped(); | |
| 826 break; | |
| 793 default: | 827 default: |
| 794 NOTREACHED(); | 828 NOTREACHED(); |
| 795 } | 829 } |
| 796 } | 830 } |
| 797 | 831 |
| 798 void WizardController::OnSetUserNamePassword(const std::string& username, | 832 void WizardController::OnSetUserNamePassword(const std::string& username, |
| 799 const std::string& password) { | 833 const std::string& password) { |
| 800 username_ = username; | 834 username_ = username; |
| 801 password_ = password; | 835 password_ = password; |
| 802 } | 836 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 814 return zero_delay_enabled_; | 848 return zero_delay_enabled_; |
| 815 } | 849 } |
| 816 | 850 |
| 817 // static | 851 // static |
| 818 void WizardController::SetZeroDelays() { | 852 void WizardController::SetZeroDelays() { |
| 819 kShowDelayMs = 0; | 853 kShowDelayMs = 0; |
| 820 zero_delay_enabled_ = true; | 854 zero_delay_enabled_ = true; |
| 821 } | 855 } |
| 822 | 856 |
| 823 } // namespace chromeos | 857 } // namespace chromeos |
| OLD | NEW |