| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 SetCurrentScreen(screen); | 321 SetCurrentScreen(screen); |
| 321 } | 322 } |
| 322 | 323 |
| 323 void WizardController::SkipRegistration() { | 324 void WizardController::SkipRegistration() { |
| 324 if (current_screen_ == GetRegistrationScreen()) | 325 if (current_screen_ == GetRegistrationScreen()) |
| 325 OnRegistrationSkipped(); | 326 OnRegistrationSkipped(); |
| 326 else | 327 else |
| 327 LOG(ERROR) << "Registration screen is not active."; | 328 LOG(ERROR) << "Registration screen is not active."; |
| 328 } | 329 } |
| 329 | 330 |
| 331 void WizardController::SkipUpdateEnrollAfterEula() { |
| 332 skip_update_enroll_after_eula_ = true; |
| 333 } |
| 334 |
| 330 // static | 335 // static |
| 331 void WizardController::RegisterPrefs(PrefService* local_state) { | 336 void WizardController::RegisterPrefs(PrefService* local_state) { |
| 332 local_state->RegisterBooleanPref(kOobeComplete, | 337 local_state->RegisterBooleanPref(kOobeComplete, |
| 333 false, | 338 false, |
| 334 PrefService::UNSYNCABLE_PREF); | 339 PrefService::UNSYNCABLE_PREF); |
| 335 local_state->RegisterIntegerPref(kDeviceRegistered, | 340 local_state->RegisterIntegerPref(kDeviceRegistered, |
| 336 -1, | 341 -1, |
| 337 PrefService::UNSYNCABLE_PREF); | 342 PrefService::UNSYNCABLE_PREF); |
| 338 local_state->RegisterBooleanPref(kEulaAccepted, | 343 local_state->RegisterBooleanPref(kEulaAccepted, |
| 339 false, | 344 false, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); | 410 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); |
| 406 CrosSettings::Get()->SetBoolean(kStatsReportingPref, enabled); | 411 CrosSettings::Get()->SetBoolean(kStatsReportingPref, enabled); |
| 407 if (enabled) { | 412 if (enabled) { |
| 408 #if defined(USE_LINUX_BREAKPAD) | 413 #if defined(USE_LINUX_BREAKPAD) |
| 409 // The crash reporter initialization needs IO to complete. | 414 // The crash reporter initialization needs IO to complete. |
| 410 base::ThreadRestrictions::ScopedAllowIO allow_io; | 415 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 411 InitCrashReporter(); | 416 InitCrashReporter(); |
| 412 #endif | 417 #endif |
| 413 } | 418 } |
| 414 | 419 |
| 415 InitiateOOBEUpdate(); | 420 if (skip_update_enroll_after_eula_) { |
| 421 PerformPostEulaActions(); |
| 422 PerformPostUpdateActions(); |
| 423 ShowEnterpriseEnrollmentScreen(); |
| 424 } else { |
| 425 InitiateOOBEUpdate(); |
| 426 } |
| 416 } | 427 } |
| 417 | 428 |
| 418 void WizardController::OnUpdateErrorCheckingForUpdate() { | 429 void WizardController::OnUpdateErrorCheckingForUpdate() { |
| 419 // TODO(nkostylev): Update should be required during OOBE. | 430 // TODO(nkostylev): Update should be required during OOBE. |
| 420 // We do not want to block users from being able to proceed to the login | 431 // 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. | 432 // 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 | 433 // They could use "browse without sign-in" feature to set up the network to be |
| 423 // able to perform the update later. | 434 // able to perform the update later. |
| 424 OnOOBECompleted(); | 435 OnOOBECompleted(); |
| 425 } | 436 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 void WizardController::OnEnterpriseEnrollmentDone() { | 483 void WizardController::OnEnterpriseEnrollmentDone() { |
| 473 ShowLoginScreen(); | 484 ShowLoginScreen(); |
| 474 } | 485 } |
| 475 | 486 |
| 476 void WizardController::OnEnterpriseAutoEnrollmentDone() { | 487 void WizardController::OnEnterpriseAutoEnrollmentDone() { |
| 477 VLOG(1) << "Automagic enrollment done, resuming previous signin"; | 488 VLOG(1) << "Automagic enrollment done, resuming previous signin"; |
| 478 ResumeLoginScreen(); | 489 ResumeLoginScreen(); |
| 479 } | 490 } |
| 480 | 491 |
| 481 void WizardController::OnOOBECompleted() { | 492 void WizardController::OnOOBECompleted() { |
| 482 MarkOobeCompleted(); | 493 PerformPostUpdateActions(); |
| 483 ShowLoginScreen(); | 494 ShowLoginScreen(); |
| 484 } | 495 } |
| 485 | 496 |
| 486 void WizardController::InitiateOOBEUpdate() { | 497 void WizardController::InitiateOOBEUpdate() { |
| 498 PerformPostEulaActions(); |
| 499 GetUpdateScreen()->StartUpdate(); |
| 500 SetCurrentScreenSmooth(GetUpdateScreen(), true); |
| 501 } |
| 502 |
| 503 void WizardController::PerformPostEulaActions() { |
| 487 // Now that EULA has been accepted (for official builds), enable portal check. | 504 // Now that EULA has been accepted (for official builds), enable portal check. |
| 488 // ChromiumOS builds would go though this code path too. | 505 // ChromiumOS builds would go though this code path too. |
| 489 chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> | 506 chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> |
| 490 SetDefaultCheckPortalList(); | 507 SetDefaultCheckPortalList(); |
| 491 host_->CheckForAutoEnrollment(); | 508 host_->CheckForAutoEnrollment(); |
| 492 GetUpdateScreen()->StartUpdate(); | |
| 493 SetCurrentScreenSmooth(GetUpdateScreen(), true); | |
| 494 } | 509 } |
| 495 | 510 |
| 511 void WizardController::PerformPostUpdateActions() { |
| 512 MarkOobeCompleted(); |
| 513 } |
| 496 | 514 |
| 497 void WizardController::SetCurrentScreen(WizardScreen* new_current) { | 515 void WizardController::SetCurrentScreen(WizardScreen* new_current) { |
| 498 SetCurrentScreenSmooth(new_current, false); | 516 SetCurrentScreenSmooth(new_current, false); |
| 499 } | 517 } |
| 500 | 518 |
| 501 void WizardController::ShowCurrentScreen() { | 519 void WizardController::ShowCurrentScreen() { |
| 502 // ShowCurrentScreen may get called by smooth_show_timer_ even after | 520 // ShowCurrentScreen may get called by smooth_show_timer_ even after |
| 503 // flow has been switched to sign in screen (ExistingUserController). | 521 // flow has been switched to sign in screen (ExistingUserController). |
| 504 if (!oobe_display_) | 522 if (!oobe_display_) |
| 505 return; | 523 return; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 NOTREACHED(); | 749 NOTREACHED(); |
| 732 } | 750 } |
| 733 } | 751 } |
| 734 | 752 |
| 735 void WizardController::OnSetUserNamePassword(const std::string& username, | 753 void WizardController::OnSetUserNamePassword(const std::string& username, |
| 736 const std::string& password) { | 754 const std::string& password) { |
| 737 username_ = username; | 755 username_ = username; |
| 738 password_ = password; | 756 password_ = password; |
| 739 } | 757 } |
| 740 | 758 |
| 741 void WizardController::set_usage_statistics_reporting(bool val) { | 759 void WizardController::SetUsageStatisticsReporting(bool val) { |
| 742 usage_statistics_reporting_ = val; | 760 usage_statistics_reporting_ = val; |
| 743 } | 761 } |
| 744 | 762 |
| 745 bool WizardController::usage_statistics_reporting() const { | 763 bool WizardController::GetUsageStatisticsReporting() const { |
| 746 return usage_statistics_reporting_; | 764 return usage_statistics_reporting_; |
| 747 } | 765 } |
| 748 | 766 |
| 749 void WizardController::SetZeroDelays() { | 767 void WizardController::SetZeroDelays() { |
| 750 kShowDelayMs = 0; | 768 kShowDelayMs = 0; |
| 751 } | 769 } |
| 752 | 770 |
| 753 } // namespace chromeos | 771 } // namespace chromeos |
| OLD | NEW |