| 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 ShowEnterpriseEnrollmentScreen(); |
| 423 } else { |
| 424 InitiateOOBEUpdate(); |
| 425 } |
| 416 } | 426 } |
| 417 | 427 |
| 418 void WizardController::OnUpdateErrorCheckingForUpdate() { | 428 void WizardController::OnUpdateErrorCheckingForUpdate() { |
| 419 // TODO(nkostylev): Update should be required during OOBE. | 429 // TODO(nkostylev): Update should be required during OOBE. |
| 420 // We do not want to block users from being able to proceed to the login | 430 // 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. | 431 // 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 | 432 // They could use "browse without sign-in" feature to set up the network to be |
| 423 // able to perform the update later. | 433 // able to perform the update later. |
| 424 OnOOBECompleted(); | 434 OnOOBECompleted(); |
| 425 } | 435 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 VLOG(1) << "Automagic enrollment done, resuming previous signin"; | 487 VLOG(1) << "Automagic enrollment done, resuming previous signin"; |
| 478 ResumeLoginScreen(); | 488 ResumeLoginScreen(); |
| 479 } | 489 } |
| 480 | 490 |
| 481 void WizardController::OnOOBECompleted() { | 491 void WizardController::OnOOBECompleted() { |
| 482 MarkOobeCompleted(); | 492 MarkOobeCompleted(); |
| 483 ShowLoginScreen(); | 493 ShowLoginScreen(); |
| 484 } | 494 } |
| 485 | 495 |
| 486 void WizardController::InitiateOOBEUpdate() { | 496 void WizardController::InitiateOOBEUpdate() { |
| 497 PerformPostEulaActions(); |
| 498 GetUpdateScreen()->StartUpdate(); |
| 499 SetCurrentScreenSmooth(GetUpdateScreen(), true); |
| 500 } |
| 501 |
| 502 void WizardController::PerformPostEulaActions() { |
| 487 // Now that EULA has been accepted (for official builds), enable portal check. | 503 // Now that EULA has been accepted (for official builds), enable portal check. |
| 488 // ChromiumOS builds would go though this code path too. | 504 // ChromiumOS builds would go though this code path too. |
| 489 chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> | 505 chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> |
| 490 SetDefaultCheckPortalList(); | 506 SetDefaultCheckPortalList(); |
| 491 host_->CheckForAutoEnrollment(); | 507 host_->CheckForAutoEnrollment(); |
| 492 GetUpdateScreen()->StartUpdate(); | |
| 493 SetCurrentScreenSmooth(GetUpdateScreen(), true); | |
| 494 } | 508 } |
| 495 | 509 |
| 496 | |
| 497 void WizardController::SetCurrentScreen(WizardScreen* new_current) { | 510 void WizardController::SetCurrentScreen(WizardScreen* new_current) { |
| 498 SetCurrentScreenSmooth(new_current, false); | 511 SetCurrentScreenSmooth(new_current, false); |
| 499 } | 512 } |
| 500 | 513 |
| 501 void WizardController::ShowCurrentScreen() { | 514 void WizardController::ShowCurrentScreen() { |
| 502 // ShowCurrentScreen may get called by smooth_show_timer_ even after | 515 // ShowCurrentScreen may get called by smooth_show_timer_ even after |
| 503 // flow has been switched to sign in screen (ExistingUserController). | 516 // flow has been switched to sign in screen (ExistingUserController). |
| 504 if (!oobe_display_) | 517 if (!oobe_display_) |
| 505 return; | 518 return; |
| 506 | 519 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 NOTREACHED(); | 744 NOTREACHED(); |
| 732 } | 745 } |
| 733 } | 746 } |
| 734 | 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 |