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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 chromeos::OobeDisplay* oobe_display) | 128 chromeos::OobeDisplay* oobe_display) |
| 129 : current_screen_(NULL), | 129 : current_screen_(NULL), |
| 130 #if defined(GOOGLE_CHROME_BUILD) | 130 #if defined(GOOGLE_CHROME_BUILD) |
| 131 is_official_build_(true), | 131 is_official_build_(true), |
| 132 #else | 132 #else |
| 133 is_official_build_(false), | 133 is_official_build_(false), |
| 134 #endif | 134 #endif |
| 135 is_out_of_box_(false), | 135 is_out_of_box_(false), |
| 136 host_(host), | 136 host_(host), |
| 137 oobe_display_(oobe_display), | 137 oobe_display_(oobe_display), |
| 138 usage_statistics_reporting_(true) { | 138 usage_statistics_reporting_(true), |
| 139 skip_update_enroll_after_eula_(false) { | |
| 139 DCHECK(default_controller_ == NULL); | 140 DCHECK(default_controller_ == NULL); |
| 140 default_controller_ = this; | 141 default_controller_ = this; |
| 141 } | 142 } |
| 142 | 143 |
| 143 WizardController::~WizardController() { | 144 WizardController::~WizardController() { |
| 144 if (default_controller_ == this) { | 145 if (default_controller_ == this) { |
| 145 default_controller_ = NULL; | 146 default_controller_ = NULL; |
| 146 } else { | 147 } else { |
| 147 NOTREACHED() << "More than one controller are alive."; | 148 NOTREACHED() << "More than one controller are alive."; |
| 148 } | 149 } |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); | 406 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); |
| 406 CrosSettings::Get()->SetBoolean(kStatsReportingPref, enabled); | 407 CrosSettings::Get()->SetBoolean(kStatsReportingPref, enabled); |
| 407 if (enabled) { | 408 if (enabled) { |
| 408 #if defined(USE_LINUX_BREAKPAD) | 409 #if defined(USE_LINUX_BREAKPAD) |
| 409 // The crash reporter initialization needs IO to complete. | 410 // The crash reporter initialization needs IO to complete. |
| 410 base::ThreadRestrictions::ScopedAllowIO allow_io; | 411 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 411 InitCrashReporter(); | 412 InitCrashReporter(); |
| 412 #endif | 413 #endif |
| 413 } | 414 } |
| 414 | 415 |
| 415 InitiateOOBEUpdate(); | 416 if (skip_update_enroll_after_eula_) { |
| 417 PerformPostEulaActions(); | |
| 418 ShowEnterpriseEnrollmentScreen(); | |
| 419 } else { | |
| 420 InitiateOOBEUpdate(); | |
| 421 } | |
| 416 } | 422 } |
| 417 | 423 |
| 418 void WizardController::OnUpdateErrorCheckingForUpdate() { | 424 void WizardController::OnUpdateErrorCheckingForUpdate() { |
| 419 // TODO(nkostylev): Update should be required during OOBE. | 425 // TODO(nkostylev): Update should be required during OOBE. |
| 420 // We do not want to block users from being able to proceed to the login | 426 // We do not want to block users from being able to proceed to the login |
| 421 // screen if there is any error checking for an update. | 427 // screen if there is any error checking for an update. |
| 422 // They could use "browse without sign-in" feature to set up the network to be | 428 // They could use "browse without sign-in" feature to set up the network to be |
| 423 // able to perform the update later. | 429 // able to perform the update later. |
| 424 OnOOBECompleted(); | 430 OnOOBECompleted(); |
| 425 } | 431 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 VLOG(1) << "Automagic enrollment done, resuming previous signin"; | 483 VLOG(1) << "Automagic enrollment done, resuming previous signin"; |
| 478 ResumeLoginScreen(); | 484 ResumeLoginScreen(); |
| 479 } | 485 } |
| 480 | 486 |
| 481 void WizardController::OnOOBECompleted() { | 487 void WizardController::OnOOBECompleted() { |
| 482 MarkOobeCompleted(); | 488 MarkOobeCompleted(); |
| 483 ShowLoginScreen(); | 489 ShowLoginScreen(); |
| 484 } | 490 } |
| 485 | 491 |
| 486 void WizardController::InitiateOOBEUpdate() { | 492 void WizardController::InitiateOOBEUpdate() { |
| 493 PerformPostEulaActions(); | |
| 494 GetUpdateScreen()->StartUpdate(); | |
| 495 SetCurrentScreenSmooth(GetUpdateScreen(), true); | |
| 496 } | |
| 497 | |
| 498 void WizardController::PerformPostEulaActions() { | |
| 487 // Now that EULA has been accepted (for official builds), enable portal check. | 499 // Now that EULA has been accepted (for official builds), enable portal check. |
| 488 // ChromiumOS builds would go though this code path too. | 500 // ChromiumOS builds would go though this code path too. |
| 489 chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> | 501 chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> |
| 490 SetDefaultCheckPortalList(); | 502 SetDefaultCheckPortalList(); |
| 491 host_->CheckForAutoEnrollment(); | 503 host_->CheckForAutoEnrollment(); |
|
Nikita (slow)
2012/04/16 16:24:47
Joao: Even though we'll be starting auto enrollmen
| |
| 492 GetUpdateScreen()->StartUpdate(); | |
| 493 SetCurrentScreenSmooth(GetUpdateScreen(), true); | |
| 494 } | 504 } |
| 495 | 505 |
| 496 | |
| 497 void WizardController::SetCurrentScreen(WizardScreen* new_current) { | 506 void WizardController::SetCurrentScreen(WizardScreen* new_current) { |
| 498 SetCurrentScreenSmooth(new_current, false); | 507 SetCurrentScreenSmooth(new_current, false); |
| 499 } | 508 } |
| 500 | 509 |
| 501 void WizardController::ShowCurrentScreen() { | 510 void WizardController::ShowCurrentScreen() { |
| 502 // ShowCurrentScreen may get called by smooth_show_timer_ even after | 511 // ShowCurrentScreen may get called by smooth_show_timer_ even after |
| 503 // flow has been switched to sign in screen (ExistingUserController). | 512 // flow has been switched to sign in screen (ExistingUserController). |
| 504 if (!oobe_display_) | 513 if (!oobe_display_) |
| 505 return; | 514 return; |
| 506 | 515 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 725 OnEnterpriseEnrollmentDone(); | 734 OnEnterpriseEnrollmentDone(); |
| 726 break; | 735 break; |
| 727 case ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED: | 736 case ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED: |
| 728 OnEnterpriseAutoEnrollmentDone(); | 737 OnEnterpriseAutoEnrollmentDone(); |
| 729 break; | 738 break; |
| 730 default: | 739 default: |
| 731 NOTREACHED(); | 740 NOTREACHED(); |
| 732 } | 741 } |
| 733 } | 742 } |
| 734 | 743 |
| 744 void WizardController::SkipUpdateEnrollAfterEula() { | |
| 745 skip_update_enroll_after_eula_ = true; | |
| 746 } | |
| 747 | |
| 735 void WizardController::OnSetUserNamePassword(const std::string& username, | 748 void WizardController::OnSetUserNamePassword(const std::string& username, |
| 736 const std::string& password) { | 749 const std::string& password) { |
| 737 username_ = username; | 750 username_ = username; |
| 738 password_ = password; | 751 password_ = password; |
| 739 } | 752 } |
| 740 | 753 |
| 741 void WizardController::set_usage_statistics_reporting(bool val) { | 754 void WizardController::SetUsageStatisticsReporting(bool val) { |
| 742 usage_statistics_reporting_ = val; | 755 usage_statistics_reporting_ = val; |
| 743 } | 756 } |
| 744 | 757 |
| 745 bool WizardController::usage_statistics_reporting() const { | 758 bool WizardController::GetUsageStatisticsReporting() const { |
| 746 return usage_statistics_reporting_; | 759 return usage_statistics_reporting_; |
| 747 } | 760 } |
| 748 | 761 |
| 749 void WizardController::SetZeroDelays() { | 762 void WizardController::SetZeroDelays() { |
| 750 kShowDelayMs = 0; | 763 kShowDelayMs = 0; |
| 751 } | 764 } |
| 752 | 765 |
| 753 } // namespace chromeos | 766 } // namespace chromeos |
| OLD | NEW |