Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(799)

Side by Side Diff: chrome/browser/chromeos/login/wizard_controller.cc

Issue 10928088: Factory reset screen is added (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed formatting Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 15 matching lines...) Expand all
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/login_display_host.h" 31 #include "chrome/browser/chromeos/login/login_display_host.h"
32 #include "chrome/browser/chromeos/login/login_utils.h" 32 #include "chrome/browser/chromeos/login/login_utils.h"
33 #include "chrome/browser/chromeos/login/network_screen.h" 33 #include "chrome/browser/chromeos/login/network_screen.h"
34 #include "chrome/browser/chromeos/login/oobe_display.h" 34 #include "chrome/browser/chromeos/login/oobe_display.h"
35 #include "chrome/browser/chromeos/login/registration_screen.h" 35 #include "chrome/browser/chromeos/login/registration_screen.h"
36 #include "chrome/browser/chromeos/login/reset_screen.h"
36 #include "chrome/browser/chromeos/login/update_screen.h" 37 #include "chrome/browser/chromeos/login/update_screen.h"
37 #include "chrome/browser/chromeos/login/user_image_screen.h" 38 #include "chrome/browser/chromeos/login/user_image_screen.h"
38 #include "chrome/browser/chromeos/login/user_manager.h" 39 #include "chrome/browser/chromeos/login/user_manager.h"
39 #include "chrome/browser/chromeos/settings/cros_settings.h" 40 #include "chrome/browser/chromeos/settings/cros_settings.h"
40 #include "chrome/browser/chromeos/settings/cros_settings_names.h" 41 #include "chrome/browser/chromeos/settings/cros_settings_names.h"
41 #include "chrome/browser/prefs/pref_service.h" 42 #include "chrome/browser/prefs/pref_service.h"
42 #include "chrome/browser/profiles/profile_manager.h" 43 #include "chrome/browser/profiles/profile_manager.h"
43 #include "chrome/browser/ui/options/options_util.h" 44 #include "chrome/browser/ui/options/options_util.h"
44 #include "chrome/common/chrome_notification_types.h" 45 #include "chrome/common/chrome_notification_types.h"
45 #include "chrome/common/pref_names.h" 46 #include "chrome/common/pref_names.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 namespace chromeos { 104 namespace chromeos {
104 105
105 const char WizardController::kNetworkScreenName[] = "network"; 106 const char WizardController::kNetworkScreenName[] = "network";
106 const char WizardController::kLoginScreenName[] = "login"; 107 const char WizardController::kLoginScreenName[] = "login";
107 const char WizardController::kUpdateScreenName[] = "update"; 108 const char WizardController::kUpdateScreenName[] = "update";
108 const char WizardController::kUserImageScreenName[] = "image"; 109 const char WizardController::kUserImageScreenName[] = "image";
109 const char WizardController::kEulaScreenName[] = "eula"; 110 const char WizardController::kEulaScreenName[] = "eula";
110 const char WizardController::kRegistrationScreenName[] = "register"; 111 const char WizardController::kRegistrationScreenName[] = "register";
111 const char WizardController::kHTMLPageScreenName[] = "html"; 112 const char WizardController::kHTMLPageScreenName[] = "html";
112 const char WizardController::kEnterpriseEnrollmentScreenName[] = "enroll"; 113 const char WizardController::kEnterpriseEnrollmentScreenName[] = "enroll";
114 const char WizardController::kResetScreenName[] = "reset";
113 115
114 // Passing this parameter as a "first screen" initiates full OOBE flow. 116 // Passing this parameter as a "first screen" initiates full OOBE flow.
115 const char WizardController::kOutOfBoxScreenName[] = "oobe"; 117 const char WizardController::kOutOfBoxScreenName[] = "oobe";
116 118
117 // Special test value that commands not to create any window yet. 119 // Special test value that commands not to create any window yet.
118 const char WizardController::kTestNoScreenName[] = "test:nowindow"; 120 const char WizardController::kTestNoScreenName[] = "test:nowindow";
119 121
120 // Initialize default controller. 122 // Initialize default controller.
121 // static 123 // static
122 WizardController* WizardController::default_controller_ = NULL; 124 WizardController* WizardController::default_controller_ = NULL;
123 125
124 // static 126 // static
125 bool WizardController::skip_user_image_selection_ = false; 127 bool WizardController::skip_user_image_selection_ = false;
126 128
127 // static 129 // static
128 bool WizardController::zero_delay_enabled_ = false; 130 bool WizardController::zero_delay_enabled_ = false;
129 131
130 /////////////////////////////////////////////////////////////////////////////// 132 ///////////////////////////////////////////////////////////////////////////////
131 // WizardController, public: 133 // WizardController, public:
132 134
133 WizardController::WizardController(chromeos::LoginDisplayHost* host, 135 WizardController::WizardController(chromeos::LoginDisplayHost* host,
134 chromeos::OobeDisplay* oobe_display) 136 chromeos::OobeDisplay* oobe_display)
135 : current_screen_(NULL), 137 : current_screen_(NULL),
138 previous_screen_(NULL),
136 #if defined(GOOGLE_CHROME_BUILD) 139 #if defined(GOOGLE_CHROME_BUILD)
137 is_official_build_(true), 140 is_official_build_(true),
138 #else 141 #else
139 is_official_build_(false), 142 is_official_build_(false),
140 #endif 143 #endif
141 is_out_of_box_(false), 144 is_out_of_box_(false),
142 host_(host), 145 host_(host),
143 oobe_display_(oobe_display), 146 oobe_display_(oobe_display),
144 usage_statistics_reporting_(true), 147 usage_statistics_reporting_(true),
145 skip_update_enroll_after_eula_(false), 148 skip_update_enroll_after_eula_(false),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 chromeos::EnterpriseEnrollmentScreen* 240 chromeos::EnterpriseEnrollmentScreen*
238 WizardController::GetEnterpriseEnrollmentScreen() { 241 WizardController::GetEnterpriseEnrollmentScreen() {
239 if (!enterprise_enrollment_screen_.get()) { 242 if (!enterprise_enrollment_screen_.get()) {
240 enterprise_enrollment_screen_.reset( 243 enterprise_enrollment_screen_.reset(
241 new chromeos::EnterpriseEnrollmentScreen( 244 new chromeos::EnterpriseEnrollmentScreen(
242 this, oobe_display_->GetEnterpriseEnrollmentScreenActor())); 245 this, oobe_display_->GetEnterpriseEnrollmentScreenActor()));
243 } 246 }
244 return enterprise_enrollment_screen_.get(); 247 return enterprise_enrollment_screen_.get();
245 } 248 }
246 249
250 chromeos::ResetScreen* WizardController::GetResetScreen() {
251 if (!reset_screen_.get()) {
252 reset_screen_.reset(
253 new chromeos::ResetScreen(this, oobe_display_->GetResetScreenActor()));
254 }
255 return reset_screen_.get();
256 }
257
247 void WizardController::ShowNetworkScreen() { 258 void WizardController::ShowNetworkScreen() {
248 VLOG(1) << "Showing network screen."; 259 VLOG(1) << "Showing network screen.";
249 SetStatusAreaVisible(false); 260 SetStatusAreaVisible(false);
250 SetCurrentScreen(GetNetworkScreen()); 261 SetCurrentScreen(GetNetworkScreen());
251 } 262 }
252 263
253 void WizardController::ShowLoginScreen() { 264 void WizardController::ShowLoginScreen() {
254 if (!time_eula_accepted_.is_null()) { 265 if (!time_eula_accepted_.is_null()) {
255 base::TimeDelta delta = base::Time::Now() - time_eula_accepted_; 266 base::TimeDelta delta = base::Time::Now() - time_eula_accepted_;
256 UMA_HISTOGRAM_MEDIUM_TIMES("OOBE.EULAToSignInTime", delta); 267 UMA_HISTOGRAM_MEDIUM_TIMES("OOBE.EULAToSignInTime", delta);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 if (screen_parameters_.get()) { 336 if (screen_parameters_.get()) {
326 screen_parameters_->GetBoolean("is_auto_enrollment", &is_auto_enrollment); 337 screen_parameters_->GetBoolean("is_auto_enrollment", &is_auto_enrollment);
327 screen_parameters_->GetString("user", &user); 338 screen_parameters_->GetString("user", &user);
328 } 339 }
329 340
330 EnterpriseEnrollmentScreen* screen = GetEnterpriseEnrollmentScreen(); 341 EnterpriseEnrollmentScreen* screen = GetEnterpriseEnrollmentScreen();
331 screen->SetParameters(is_auto_enrollment, user); 342 screen->SetParameters(is_auto_enrollment, user);
332 SetCurrentScreen(screen); 343 SetCurrentScreen(screen);
333 } 344 }
334 345
346 void WizardController::ShowResetScreen() {
347 VLOG(1) << "Showing reset screen.";
348 SetStatusAreaVisible(false);
349 SetCurrentScreen(GetResetScreen());
350 }
351
335 void WizardController::SkipToLoginForTesting() { 352 void WizardController::SkipToLoginForTesting() {
336 MarkEulaAccepted(); 353 MarkEulaAccepted();
337 PerformPostEulaActions(); 354 PerformPostEulaActions();
338 PerformPostUpdateActions(); 355 PerformPostUpdateActions();
339 ShowLoginScreen(); 356 ShowLoginScreen();
340 } 357 }
341 358
342 void WizardController::SkipImageSelectionForTesting() { 359 void WizardController::SkipImageSelectionForTesting() {
343 skip_user_image_selection_ = true; 360 skip_user_image_selection_ = true;
344 } 361 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 530
514 void WizardController::OnRegistrationSkipped() { 531 void WizardController::OnRegistrationSkipped() {
515 // TODO(nkostylev): Track in a histogram? 532 // TODO(nkostylev): Track in a histogram?
516 OnRegistrationSuccess(); 533 OnRegistrationSuccess();
517 } 534 }
518 535
519 void WizardController::OnEnterpriseEnrollmentDone() { 536 void WizardController::OnEnterpriseEnrollmentDone() {
520 ShowLoginScreen(); 537 ShowLoginScreen();
521 } 538 }
522 539
540 void WizardController::OnResetCanceled() {
541 if (previous_screen_)
542 SetCurrentScreen(previous_screen_);
543 else
544 ShowLoginScreen();
545 }
546
523 void WizardController::OnEnterpriseAutoEnrollmentDone() { 547 void WizardController::OnEnterpriseAutoEnrollmentDone() {
524 VLOG(1) << "Automagic enrollment done, resuming previous signin"; 548 VLOG(1) << "Automagic enrollment done, resuming previous signin";
525 ResumeLoginScreen(); 549 ResumeLoginScreen();
526 } 550 }
527 551
528 void WizardController::OnOOBECompleted() { 552 void WizardController::OnOOBECompleted() {
529 PerformPostUpdateActions(); 553 PerformPostUpdateActions();
530 ShowLoginScreen(); 554 ShowLoginScreen();
531 } 555 }
532 556
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 new_current == NULL || 595 new_current == NULL ||
572 oobe_display_ == NULL) { 596 oobe_display_ == NULL) {
573 return; 597 return;
574 } 598 }
575 599
576 smooth_show_timer_.Stop(); 600 smooth_show_timer_.Stop();
577 601
578 if (current_screen_) 602 if (current_screen_)
579 oobe_display_->HideScreen(current_screen_); 603 oobe_display_->HideScreen(current_screen_);
580 604
605 previous_screen_ = current_screen_;
581 current_screen_ = new_current; 606 current_screen_ = new_current;
582 607
583 if (use_smoothing) { 608 if (use_smoothing) {
584 smooth_show_timer_.Start( 609 smooth_show_timer_.Start(
585 FROM_HERE, 610 FROM_HERE,
586 base::TimeDelta::FromMilliseconds(kShowDelayMs), 611 base::TimeDelta::FromMilliseconds(kShowDelayMs),
587 this, 612 this,
588 &WizardController::ShowCurrentScreen); 613 &WizardController::ShowCurrentScreen);
589 } else { 614 } else {
590 ShowCurrentScreen(); 615 ShowCurrentScreen();
(...skipping 15 matching lines...) Expand all
606 ShowUserImageScreen(); 631 ShowUserImageScreen();
607 } else if (screen_name == kEulaScreenName) { 632 } else if (screen_name == kEulaScreenName) {
608 ShowEulaScreen(); 633 ShowEulaScreen();
609 } else if (screen_name == kRegistrationScreenName) { 634 } else if (screen_name == kRegistrationScreenName) {
610 if (is_official_build_) { 635 if (is_official_build_) {
611 ShowRegistrationScreen(); 636 ShowRegistrationScreen();
612 } else { 637 } else {
613 // Just proceed to image screen. 638 // Just proceed to image screen.
614 OnRegistrationSuccess(); 639 OnRegistrationSuccess();
615 } 640 }
641 } else if (screen_name == kResetScreenName) {
642 ShowResetScreen();
616 } else if (screen_name == kHTMLPageScreenName) { 643 } else if (screen_name == kHTMLPageScreenName) {
617 ShowHTMLPageScreen(); 644 ShowHTMLPageScreen();
618 } else if (screen_name == kEnterpriseEnrollmentScreenName) { 645 } else if (screen_name == kEnterpriseEnrollmentScreenName) {
619 ShowEnterpriseEnrollmentScreen(); 646 ShowEnterpriseEnrollmentScreen();
620 } else if (screen_name != kTestNoScreenName) { 647 } else if (screen_name != kTestNoScreenName) {
621 if (is_out_of_box_) { 648 if (is_out_of_box_) {
622 ShowNetworkScreen(); 649 ShowNetworkScreen();
623 } else { 650 } else {
624 ShowLoginScreen(); 651 ShowLoginScreen();
625 } 652 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 break; 793 break;
767 case REGISTRATION_SUCCESS: 794 case REGISTRATION_SUCCESS:
768 OnRegistrationSuccess(); 795 OnRegistrationSuccess();
769 break; 796 break;
770 case REGISTRATION_SKIPPED: 797 case REGISTRATION_SKIPPED:
771 OnRegistrationSkipped(); 798 OnRegistrationSkipped();
772 break; 799 break;
773 case ENTERPRISE_ENROLLMENT_COMPLETED: 800 case ENTERPRISE_ENROLLMENT_COMPLETED:
774 OnEnterpriseEnrollmentDone(); 801 OnEnterpriseEnrollmentDone();
775 break; 802 break;
803 case RESET_CANCELED:
804 OnResetCanceled();
805 break;
776 case ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED: 806 case ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED:
777 OnEnterpriseAutoEnrollmentDone(); 807 OnEnterpriseAutoEnrollmentDone();
778 break; 808 break;
779 default: 809 default:
780 NOTREACHED(); 810 NOTREACHED();
781 } 811 }
782 } 812 }
783 813
784 void WizardController::OnSetUserNamePassword(const std::string& username, 814 void WizardController::OnSetUserNamePassword(const std::string& username,
785 const std::string& password) { 815 const std::string& password) {
(...skipping 14 matching lines...) Expand all
800 return zero_delay_enabled_; 830 return zero_delay_enabled_;
801 } 831 }
802 832
803 // static 833 // static
804 void WizardController::SetZeroDelays() { 834 void WizardController::SetZeroDelays() {
805 kShowDelayMs = 0; 835 kShowDelayMs = 0;
806 zero_delay_enabled_ = true; 836 zero_delay_enabled_ = true;
807 } 837 }
808 838
809 } // namespace chromeos 839 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.h ('k') | chrome/browser/chromeos/login/wizard_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698