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

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

Issue 289133002: Add a enterprise enrollment check screen to OOBE in ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjusted tests and replaced webkit-box with flex. Created 6 years, 6 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
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/callback_helpers.h" 15 #include "base/callback_helpers.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/prefs/pref_registry_simple.h" 18 #include "base/prefs/pref_registry_simple.h"
19 #include "base/prefs/pref_service.h" 19 #include "base/prefs/pref_service.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/threading/thread_restrictions.h" 21 #include "base/threading/thread_restrictions.h"
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/chrome_notification_types.h" 24 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 25 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
26 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" 26 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
27 #include "chrome/browser/chromeos/customization_document.h" 27 #include "chrome/browser/chromeos/customization_document.h"
28 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" 28 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h"
29 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_step.h" 29 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen. h"
30 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" 30 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h"
31 #include "chrome/browser/chromeos/login/existing_user_controller.h" 31 #include "chrome/browser/chromeos/login/existing_user_controller.h"
32 #include "chrome/browser/chromeos/login/helper.h" 32 #include "chrome/browser/chromeos/login/helper.h"
33 #include "chrome/browser/chromeos/login/hwid_checker.h" 33 #include "chrome/browser/chromeos/login/hwid_checker.h"
34 #include "chrome/browser/chromeos/login/login_utils.h" 34 #include "chrome/browser/chromeos/login/login_utils.h"
35 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc reen.h" 35 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc reen.h"
36 #include "chrome/browser/chromeos/login/screens/error_screen.h" 36 #include "chrome/browser/chromeos/login/screens/error_screen.h"
37 #include "chrome/browser/chromeos/login/screens/eula_screen.h" 37 #include "chrome/browser/chromeos/login/screens/eula_screen.h"
38 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" 38 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h"
39 #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h" 39 #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 const char WizardController::kLoginScreenName[] = "login"; 118 const char WizardController::kLoginScreenName[] = "login";
119 const char WizardController::kUpdateScreenName[] = "update"; 119 const char WizardController::kUpdateScreenName[] = "update";
120 const char WizardController::kUserImageScreenName[] = "image"; 120 const char WizardController::kUserImageScreenName[] = "image";
121 const char WizardController::kEulaScreenName[] = "eula"; 121 const char WizardController::kEulaScreenName[] = "eula";
122 const char WizardController::kEnrollmentScreenName[] = "enroll"; 122 const char WizardController::kEnrollmentScreenName[] = "enroll";
123 const char WizardController::kResetScreenName[] = "reset"; 123 const char WizardController::kResetScreenName[] = "reset";
124 const char WizardController::kKioskEnableScreenName[] = "kiosk-enable"; 124 const char WizardController::kKioskEnableScreenName[] = "kiosk-enable";
125 const char WizardController::kKioskAutolaunchScreenName[] = "autolaunch"; 125 const char WizardController::kKioskAutolaunchScreenName[] = "autolaunch";
126 const char WizardController::kErrorScreenName[] = "error-message"; 126 const char WizardController::kErrorScreenName[] = "error-message";
127 const char WizardController::kTermsOfServiceScreenName[] = "tos"; 127 const char WizardController::kTermsOfServiceScreenName[] = "tos";
128 const char WizardController::kAutoEnrollmentCheckScreenName[] =
129 "auto-enrollment-check";
128 const char WizardController::kWrongHWIDScreenName[] = "wrong-hwid"; 130 const char WizardController::kWrongHWIDScreenName[] = "wrong-hwid";
129 const char WizardController::kLocallyManagedUserCreationScreenName[] = 131 const char WizardController::kLocallyManagedUserCreationScreenName[] =
130 "locally-managed-user-creation-flow"; 132 "locally-managed-user-creation-flow";
131 const char WizardController::kAppLaunchSplashScreenName[] = 133 const char WizardController::kAppLaunchSplashScreenName[] =
132 "app-launch-splash"; 134 "app-launch-splash";
133 const char WizardController::kHIDDetectionScreenName[] = "hid-detection"; 135 const char WizardController::kHIDDetectionScreenName[] = "hid-detection";
134 136
135 // static 137 // static
136 const int WizardController::kMinAudibleOutputVolumePercent = 10; 138 const int WizardController::kMinAudibleOutputVolumePercent = 10;
137 139
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 322
321 chromeos::WrongHWIDScreen* WizardController::GetWrongHWIDScreen() { 323 chromeos::WrongHWIDScreen* WizardController::GetWrongHWIDScreen() {
322 if (!wrong_hwid_screen_.get()) { 324 if (!wrong_hwid_screen_.get()) {
323 wrong_hwid_screen_.reset( 325 wrong_hwid_screen_.reset(
324 new chromeos::WrongHWIDScreen( 326 new chromeos::WrongHWIDScreen(
325 this, oobe_display_->GetWrongHWIDScreenActor())); 327 this, oobe_display_->GetWrongHWIDScreenActor()));
326 } 328 }
327 return wrong_hwid_screen_.get(); 329 return wrong_hwid_screen_.get();
328 } 330 }
329 331
332 chromeos::AutoEnrollmentCheckScreen*
333 WizardController::GetAutoEnrollmentCheckScreen() {
334 if (!auto_enrollment_check_screen_.get()) {
335 auto_enrollment_check_screen_.reset(
336 new chromeos::AutoEnrollmentCheckScreen(
337 this,
338 oobe_display_->GetAutoEnrollmentCheckScreenActor()));
339 }
340 return auto_enrollment_check_screen_.get();
341 }
342
330 chromeos::LocallyManagedUserCreationScreen* 343 chromeos::LocallyManagedUserCreationScreen*
331 WizardController::GetLocallyManagedUserCreationScreen() { 344 WizardController::GetLocallyManagedUserCreationScreen() {
332 if (!locally_managed_user_creation_screen_.get()) { 345 if (!locally_managed_user_creation_screen_.get()) {
333 locally_managed_user_creation_screen_.reset( 346 locally_managed_user_creation_screen_.reset(
334 new chromeos::LocallyManagedUserCreationScreen( 347 new chromeos::LocallyManagedUserCreationScreen(
335 this, oobe_display_->GetLocallyManagedUserCreationScreenActor())); 348 this, oobe_display_->GetLocallyManagedUserCreationScreenActor()));
336 } 349 }
337 return locally_managed_user_creation_screen_.get(); 350 return locally_managed_user_creation_screen_.get();
338 } 351 }
339 352
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 SetStatusAreaVisible(true); 488 SetStatusAreaVisible(true);
476 SetCurrentScreen(GetTermsOfServiceScreen()); 489 SetCurrentScreen(GetTermsOfServiceScreen());
477 } 490 }
478 491
479 void WizardController::ShowWrongHWIDScreen() { 492 void WizardController::ShowWrongHWIDScreen() {
480 VLOG(1) << "Showing wrong HWID screen."; 493 VLOG(1) << "Showing wrong HWID screen.";
481 SetStatusAreaVisible(false); 494 SetStatusAreaVisible(false);
482 SetCurrentScreen(GetWrongHWIDScreen()); 495 SetCurrentScreen(GetWrongHWIDScreen());
483 } 496 }
484 497
498 void WizardController::ShowAutoEnrollmentCheckScreen() {
499 VLOG(1) << "Showing Auto-enrollment check screen.";
500 SetStatusAreaVisible(true);
501 AutoEnrollmentCheckScreen* screen = GetAutoEnrollmentCheckScreen();
502 screen->set_auto_enrollment_controller(host_->GetAutoEnrollmentController());
503 SetCurrentScreen(screen);
504 }
505
485 void WizardController::ShowLocallyManagedUserCreationScreen() { 506 void WizardController::ShowLocallyManagedUserCreationScreen() {
486 VLOG(1) << "Showing Locally managed user creation screen screen."; 507 VLOG(1) << "Showing Locally managed user creation screen screen.";
487 SetStatusAreaVisible(true); 508 SetStatusAreaVisible(true);
488 LocallyManagedUserCreationScreen* screen = 509 LocallyManagedUserCreationScreen* screen =
489 GetLocallyManagedUserCreationScreen(); 510 GetLocallyManagedUserCreationScreen();
490 SetCurrentScreen(screen); 511 SetCurrentScreen(screen);
491 } 512 }
492 513
493 void WizardController::ShowHIDDetectionScreen() { 514 void WizardController::ShowHIDDetectionScreen() {
494 VLOG(1) << "Showing HID discovery screen."; 515 VLOG(1) << "Showing HID discovery screen.";
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 // should report some error message here and stay on the same screen. 573 // should report some error message here and stay on the same screen.
553 ShowLoginScreen(LoginScreenContext()); 574 ShowLoginScreen(LoginScreenContext());
554 } 575 }
555 576
556 void WizardController::OnConnectionFailed() { 577 void WizardController::OnConnectionFailed() {
557 // TODO(dpolukhin): show error message after login screen is displayed. 578 // TODO(dpolukhin): show error message after login screen is displayed.
558 ShowLoginScreen(LoginScreenContext()); 579 ShowLoginScreen(LoginScreenContext());
559 } 580 }
560 581
561 void WizardController::OnUpdateCompleted() { 582 void WizardController::OnUpdateCompleted() {
562 StartAutoEnrollmentCheck(); 583 ShowAutoEnrollmentCheckScreen();
563 } 584 }
564 585
565 void WizardController::OnEulaAccepted() { 586 void WizardController::OnEulaAccepted() {
566 time_eula_accepted_ = base::Time::Now(); 587 time_eula_accepted_ = base::Time::Now();
567 StartupUtils::MarkEulaAccepted(); 588 StartupUtils::MarkEulaAccepted();
568 bool uma_enabled = 589 bool uma_enabled =
569 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); 590 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_);
570 591
571 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); 592 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled);
572 if (uma_enabled) { 593 if (uma_enabled) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 else 693 else
673 ShowLoginScreen(LoginScreenContext()); 694 ShowLoginScreen(LoginScreenContext());
674 } 695 }
675 696
676 void WizardController::OnAutoEnrollmentDone() { 697 void WizardController::OnAutoEnrollmentDone() {
677 VLOG(1) << "Automagic enrollment done, resuming previous signin"; 698 VLOG(1) << "Automagic enrollment done, resuming previous signin";
678 ResumeLoginScreen(); 699 ResumeLoginScreen();
679 } 700 }
680 701
681 void WizardController::OnOOBECompleted() { 702 void WizardController::OnOOBECompleted() {
682 auto_enrollment_check_step_.reset();
683 if (ShouldAutoStartEnrollment()) { 703 if (ShouldAutoStartEnrollment()) {
684 ShowEnrollmentScreen(); 704 ShowEnrollmentScreen();
685 } else { 705 } else {
686 PerformOOBECompletedActions(); 706 PerformOOBECompletedActions();
687 ShowLoginScreen(LoginScreenContext()); 707 ShowLoginScreen(LoginScreenContext());
688 } 708 }
689 } 709 }
690 710
691 void WizardController::OnTermsOfServiceDeclined() { 711 void WizardController::OnTermsOfServiceDeclined() {
692 // If the user declines the Terms of Service, end the session and return to 712 // If the user declines the Terms of Service, end the session and return to
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 } else if (screen_name == kKioskEnableScreenName) { 830 } else if (screen_name == kKioskEnableScreenName) {
811 ShowKioskEnableScreen(); 831 ShowKioskEnableScreen();
812 } else if (screen_name == kKioskAutolaunchScreenName) { 832 } else if (screen_name == kKioskAutolaunchScreenName) {
813 ShowKioskAutolaunchScreen(); 833 ShowKioskAutolaunchScreen();
814 } else if (screen_name == kEnrollmentScreenName) { 834 } else if (screen_name == kEnrollmentScreenName) {
815 ShowEnrollmentScreen(); 835 ShowEnrollmentScreen();
816 } else if (screen_name == kTermsOfServiceScreenName) { 836 } else if (screen_name == kTermsOfServiceScreenName) {
817 ShowTermsOfServiceScreen(); 837 ShowTermsOfServiceScreen();
818 } else if (screen_name == kWrongHWIDScreenName) { 838 } else if (screen_name == kWrongHWIDScreenName) {
819 ShowWrongHWIDScreen(); 839 ShowWrongHWIDScreen();
840 } else if (screen_name == kAutoEnrollmentCheckScreenName) {
841 ShowAutoEnrollmentCheckScreen();
820 } else if (screen_name == kLocallyManagedUserCreationScreenName) { 842 } else if (screen_name == kLocallyManagedUserCreationScreenName) {
821 ShowLocallyManagedUserCreationScreen(); 843 ShowLocallyManagedUserCreationScreen();
822 } else if (screen_name == kAppLaunchSplashScreenName) { 844 } else if (screen_name == kAppLaunchSplashScreenName) {
823 AutoLaunchKioskApp(); 845 AutoLaunchKioskApp();
824 } else if (screen_name == kHIDDetectionScreenName) { 846 } else if (screen_name == kHIDDetectionScreenName) {
825 ShowHIDDetectionScreen(); 847 ShowHIDDetectionScreen();
826 } else if (screen_name != kTestNoScreenName) { 848 } else if (screen_name != kTestNoScreenName) {
827 if (is_out_of_box_) { 849 if (is_out_of_box_) {
828 if (CanShowHIDDetectionScreen()) 850 if (CanShowHIDDetectionScreen())
829 ShowHIDDetectionScreen(); 851 ShowHIDDetectionScreen();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 void WizardController::OnLocalStateInitialized(bool /* succeeded */) { 1028 void WizardController::OnLocalStateInitialized(bool /* succeeded */) {
1007 if (GetLocalState()->GetInitializationStatus() != 1029 if (GetLocalState()->GetInitializationStatus() !=
1008 PrefService::INITIALIZATION_STATUS_ERROR) { 1030 PrefService::INITIALIZATION_STATUS_ERROR) {
1009 return; 1031 return;
1010 } 1032 }
1011 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_LOCAL_STATE_ERROR); 1033 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_LOCAL_STATE_ERROR);
1012 SetStatusAreaVisible(false); 1034 SetStatusAreaVisible(false);
1013 ShowErrorScreen(); 1035 ShowErrorScreen();
1014 } 1036 }
1015 1037
1016 void WizardController::StartAutoEnrollmentCheck() {
1017 auto_enrollment_check_step_.reset(
1018 new AutoEnrollmentCheckStep(this, host_->GetAutoEnrollmentController()));
1019 auto_enrollment_check_step_->Start();
1020 }
1021
1022 PrefService* WizardController::GetLocalState() { 1038 PrefService* WizardController::GetLocalState() {
1023 if (local_state_for_testing_) 1039 if (local_state_for_testing_)
1024 return local_state_for_testing_; 1040 return local_state_for_testing_;
1025 return g_browser_process->local_state(); 1041 return g_browser_process->local_state();
1026 } 1042 }
1027 1043
1028 void WizardController::OnTimezoneResolved( 1044 void WizardController::OnTimezoneResolved(
1029 scoped_ptr<TimeZoneResponseData> timezone, 1045 scoped_ptr<TimeZoneResponseData> timezone,
1030 bool server_error) { 1046 bool server_error) {
1031 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1047 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 bool WizardController::SetOnTimeZoneResolvedForTesting( 1123 bool WizardController::SetOnTimeZoneResolvedForTesting(
1108 const base::Closure& callback) { 1124 const base::Closure& callback) {
1109 if (timezone_resolved_) 1125 if (timezone_resolved_)
1110 return false; 1126 return false;
1111 1127
1112 on_timezone_resolved_for_testing_ = callback; 1128 on_timezone_resolved_for_testing_ = callback;
1113 return true; 1129 return true;
1114 } 1130 }
1115 1131
1116 } // namespace chromeos 1132 } // 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