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

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

Issue 387403003: Fix UI glitches in enterprise enrollment recovery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 5 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h" 48 #include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h"
49 #include "chrome/browser/chromeos/login/startup_utils.h" 49 #include "chrome/browser/chromeos/login/startup_utils.h"
50 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 50 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
51 #include "chrome/browser/chromeos/login/ui/oobe_display.h" 51 #include "chrome/browser/chromeos/login/ui/oobe_display.h"
52 #include "chrome/browser/chromeos/login/users/user_manager.h" 52 #include "chrome/browser/chromeos/login/users/user_manager.h"
53 #include "chrome/browser/chromeos/net/delay_network_call.h" 53 #include "chrome/browser/chromeos/net/delay_network_call.h"
54 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 54 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
55 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" 55 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h"
56 #include "chrome/browser/chromeos/settings/cros_settings.h" 56 #include "chrome/browser/chromeos/settings/cros_settings.h"
57 #include "chrome/browser/chromeos/timezone/timezone_provider.h" 57 #include "chrome/browser/chromeos/timezone/timezone_provider.h"
58 #include "chrome/browser/lifetime/application_lifetime.h"
58 #include "chrome/browser/profiles/profile.h" 59 #include "chrome/browser/profiles/profile.h"
59 #include "chrome/browser/profiles/profile_manager.h" 60 #include "chrome/browser/profiles/profile_manager.h"
60 #include "chrome/browser/ui/options/options_util.h" 61 #include "chrome/browser/ui/options/options_util.h"
61 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" 62 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
62 #include "chrome/common/chrome_constants.h" 63 #include "chrome/common/chrome_constants.h"
63 #include "chrome/common/pref_names.h" 64 #include "chrome/common/pref_names.h"
64 #include "chromeos/audio/cras_audio_handler.h" 65 #include "chromeos/audio/cras_audio_handler.h"
65 #include "chromeos/chromeos_constants.h" 66 #include "chromeos/chromeos_constants.h"
66 #include "chromeos/chromeos_switches.h" 67 #include "chromeos/chromeos_switches.h"
67 #include "chromeos/dbus/dbus_thread_manager.h" 68 #include "chromeos/dbus/dbus_thread_manager.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 #if defined(GOOGLE_CHROME_BUILD) 198 #if defined(GOOGLE_CHROME_BUILD)
198 is_official_build_(true), 199 is_official_build_(true),
199 #else 200 #else
200 is_official_build_(false), 201 is_official_build_(false),
201 #endif 202 #endif
202 is_out_of_box_(false), 203 is_out_of_box_(false),
203 host_(host), 204 host_(host),
204 oobe_display_(oobe_display), 205 oobe_display_(oobe_display),
205 usage_statistics_reporting_(true), 206 usage_statistics_reporting_(true),
206 skip_update_enroll_after_eula_(false), 207 skip_update_enroll_after_eula_(false),
208 enrollment_recovery_(ShouldRecoverEnrollment()),
207 login_screen_started_(false), 209 login_screen_started_(false),
208 user_image_screen_return_to_previous_hack_(false), 210 user_image_screen_return_to_previous_hack_(false),
209 timezone_resolved_(false), 211 timezone_resolved_(false),
210 weak_factory_(this) { 212 weak_factory_(this) {
211 DCHECK(default_controller_ == NULL); 213 DCHECK(default_controller_ == NULL);
212 default_controller_ = this; 214 default_controller_ = this;
213 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); 215 AccessibilityManager* accessibility_manager = AccessibilityManager::Get();
214 CHECK(accessibility_manager); 216 CHECK(accessibility_manager);
215 accessibility_subscription_ = accessibility_manager->RegisterCallback( 217 accessibility_subscription_ = accessibility_manager->RegisterCallback(
216 base::Bind(&WizardController::OnAccessibilityStatusChanged, 218 base::Bind(&WizardController::OnAccessibilityStatusChanged,
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 486
485 SetStatusAreaVisible(true); 487 SetStatusAreaVisible(true);
486 488
487 bool is_auto_enrollment = false; 489 bool is_auto_enrollment = false;
488 std::string user; 490 std::string user;
489 if (screen_parameters_.get()) { 491 if (screen_parameters_.get()) {
490 screen_parameters_->GetBoolean("is_auto_enrollment", &is_auto_enrollment); 492 screen_parameters_->GetBoolean("is_auto_enrollment", &is_auto_enrollment);
491 screen_parameters_->GetString("user", &user); 493 screen_parameters_->GetString("user", &user);
492 } 494 }
493 495
494 EnrollmentScreenActor::EnrollmentMode mode; 496 EnrollmentScreenActor::EnrollmentMode mode =
495 if (is_auto_enrollment) 497 EnrollmentScreenActor::ENROLLMENT_MODE_MANUAL;
498 EnrollmentScreen* screen = GetEnrollmentScreen();
499 std::string enrollment_domain = GetForcedEnrollmentDomain();
500 if (is_auto_enrollment) {
496 mode = EnrollmentScreenActor::ENROLLMENT_MODE_AUTO; 501 mode = EnrollmentScreenActor::ENROLLMENT_MODE_AUTO;
497 else if (ShouldRecoverEnrollment()) 502 } else if (enrollment_recovery_) {
498 mode = EnrollmentScreenActor::ENROLLMENT_MODE_RECOVERY; 503 mode = EnrollmentScreenActor::ENROLLMENT_MODE_RECOVERY;
499 else if (ShouldAutoStartEnrollment() && !CanExitEnrollment()) 504 enrollment_domain = GetEnrollmentRecoveryDomain();
505 } else if (ShouldAutoStartEnrollment() && !CanExitEnrollment()) {
500 mode = EnrollmentScreenActor::ENROLLMENT_MODE_FORCED; 506 mode = EnrollmentScreenActor::ENROLLMENT_MODE_FORCED;
501 else 507 }
502 mode = EnrollmentScreenActor::ENROLLMENT_MODE_MANUAL;
503 508
504 EnrollmentScreen* screen = GetEnrollmentScreen(); 509 screen->SetParameters(mode, enrollment_domain, user);
505 screen->SetParameters(mode, GetForcedEnrollmentDomain(), user);
506 SetCurrentScreen(screen); 510 SetCurrentScreen(screen);
507 } 511 }
508 512
509 void WizardController::ShowResetScreen() { 513 void WizardController::ShowResetScreen() {
510 VLOG(1) << "Showing reset screen."; 514 VLOG(1) << "Showing reset screen.";
511 SetStatusAreaVisible(false); 515 SetStatusAreaVisible(false);
512 SetCurrentScreen(GetResetScreen()); 516 SetCurrentScreen(GetResetScreen());
513 } 517 }
514 518
515 void WizardController::ShowKioskEnableScreen() { 519 void WizardController::ShowKioskEnableScreen() {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 host_ = NULL; 729 host_ = NULL;
726 } 730 }
727 731
728 void WizardController::OnUserImageSkipped() { 732 void WizardController::OnUserImageSkipped() {
729 OnUserImageSelected(); 733 OnUserImageSelected();
730 } 734 }
731 735
732 void WizardController::OnEnrollmentDone() { 736 void WizardController::OnEnrollmentDone() {
733 // Mark OOBE as completed only if enterprise enrollment was part of the 737 // Mark OOBE as completed only if enterprise enrollment was part of the
734 // forced flow (i.e. app kiosk). 738 // forced flow (i.e. app kiosk).
735 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) 739 if (ShouldAutoStartEnrollment() || enrollment_recovery_)
736 PerformOOBECompletedActions(); 740 PerformOOBECompletedActions();
737 741
738 // TODO(mnissler): Unify the logic for auto-login for Public Sessions and 742 // TODO(mnissler): Unify the logic for auto-login for Public Sessions and
739 // Kiosk Apps and make this code cover both cases: http://crbug.com/234694. 743 // Kiosk Apps and make this code cover both cases: http://crbug.com/234694.
740 if (KioskAppManager::Get()->IsAutoLaunchEnabled()) 744 if (KioskAppManager::Get()->IsAutoLaunchEnabled())
741 AutoLaunchKioskApp(); 745 AutoLaunchKioskApp();
742 else 746 else
743 ShowLoginScreen(LoginScreenContext()); 747 ShowLoginScreen(LoginScreenContext());
744 } 748 }
745 749
(...skipping 24 matching lines...) Expand all
770 else 774 else
771 ShowLoginScreen(LoginScreenContext()); 775 ShowLoginScreen(LoginScreenContext());
772 } 776 }
773 777
774 void WizardController::OnAutoEnrollmentDone() { 778 void WizardController::OnAutoEnrollmentDone() {
775 VLOG(1) << "Automagic enrollment done, resuming previous signin"; 779 VLOG(1) << "Automagic enrollment done, resuming previous signin";
776 ResumeLoginScreen(); 780 ResumeLoginScreen();
777 } 781 }
778 782
779 void WizardController::OnOOBECompleted() { 783 void WizardController::OnOOBECompleted() {
780 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) { 784 if (ShouldAutoStartEnrollment() || enrollment_recovery_) {
781 ShowEnrollmentScreen(); 785 ShowEnrollmentScreen();
782 } else { 786 } else {
783 PerformOOBECompletedActions(); 787 PerformOOBECompletedActions();
784 ShowLoginScreen(LoginScreenContext()); 788 ShowLoginScreen(LoginScreenContext());
785 } 789 }
786 } 790 }
787 791
788 void WizardController::OnTermsOfServiceDeclined() { 792 void WizardController::OnTermsOfServiceDeclined() {
789 // If the user declines the Terms of Service, end the session and return to 793 // If the user declines the Terms of Service, end the session and return to
790 // the login screen. 794 // the login screen.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 host_->PrewarmAuthentication(); 842 host_->PrewarmAuthentication();
839 NetworkPortalDetector::Get()->Enable(true); 843 NetworkPortalDetector::Get()->Enable(true);
840 } 844 }
841 845
842 void WizardController::PerformOOBECompletedActions() { 846 void WizardController::PerformOOBECompletedActions() {
843 UMA_HISTOGRAM_COUNTS_100( 847 UMA_HISTOGRAM_COUNTS_100(
844 "HIDDetection.TimesDialogShownPerOOBECompleted", 848 "HIDDetection.TimesDialogShownPerOOBECompleted",
845 GetLocalState()->GetInteger(prefs::kTimesHIDDialogShown)); 849 GetLocalState()->GetInteger(prefs::kTimesHIDDialogShown));
846 GetLocalState()->ClearPref(prefs::kTimesHIDDialogShown); 850 GetLocalState()->ClearPref(prefs::kTimesHIDDialogShown);
847 StartupUtils::MarkOobeCompleted(); 851 StartupUtils::MarkOobeCompleted();
852
853 if (enrollment_recovery_)
854 chrome::AttemptRestart();
848 } 855 }
849 856
850 void WizardController::SetCurrentScreen(WizardScreen* new_current) { 857 void WizardController::SetCurrentScreen(WizardScreen* new_current) {
851 SetCurrentScreenSmooth(new_current, false); 858 SetCurrentScreenSmooth(new_current, false);
852 } 859 }
853 860
854 void WizardController::ShowCurrentScreen() { 861 void WizardController::ShowCurrentScreen() {
855 // ShowCurrentScreen may get called by smooth_show_timer_ even after 862 // ShowCurrentScreen may get called by smooth_show_timer_ even after
856 // flow has been switched to sign in screen (ExistingUserController). 863 // flow has been switched to sign in screen (ExistingUserController).
857 if (!oobe_display_) 864 if (!oobe_display_)
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 // static 1143 // static
1137 bool WizardController::ShouldRecoverEnrollment() { 1144 bool WizardController::ShouldRecoverEnrollment() {
1138 policy::BrowserPolicyConnectorChromeOS* connector = 1145 policy::BrowserPolicyConnectorChromeOS* connector =
1139 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 1146 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1140 policy::DeviceCloudPolicyInitializer* dcp_initializer = 1147 policy::DeviceCloudPolicyInitializer* dcp_initializer =
1141 connector->GetDeviceCloudPolicyInitializer(); 1148 connector->GetDeviceCloudPolicyInitializer();
1142 return dcp_initializer && dcp_initializer->ShouldRecoverEnrollment(); 1149 return dcp_initializer && dcp_initializer->ShouldRecoverEnrollment();
1143 } 1150 }
1144 1151
1145 // static 1152 // static
1153 std::string WizardController::GetEnrollmentRecoveryDomain() {
1154 policy::BrowserPolicyConnectorChromeOS* connector =
1155 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1156 policy::DeviceCloudPolicyInitializer* dcp_initializer =
1157 connector->GetDeviceCloudPolicyInitializer();
1158 if (!dcp_initializer)
1159 return std::string();
1160 return dcp_initializer->GetEnrollmentRecoveryDomain();
1161 }
1162
1163 // static
1146 bool WizardController::CanExitEnrollment() { 1164 bool WizardController::CanExitEnrollment() {
1147 policy::BrowserPolicyConnectorChromeOS* connector = 1165 policy::BrowserPolicyConnectorChromeOS* connector =
1148 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 1166 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1149 CHECK(connector); 1167 CHECK(connector);
1150 return connector->GetDeviceCloudPolicyInitializer()->CanExitEnrollment(); 1168 return connector->GetDeviceCloudPolicyInitializer()->CanExitEnrollment();
1151 } 1169 }
1152 1170
1153 // static 1171 // static
1154 std::string WizardController::GetForcedEnrollmentDomain() { 1172 std::string WizardController::GetForcedEnrollmentDomain() {
1155 policy::BrowserPolicyConnectorChromeOS* connector = 1173 policy::BrowserPolicyConnectorChromeOS* connector =
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 bool WizardController::SetOnTimeZoneResolvedForTesting( 1275 bool WizardController::SetOnTimeZoneResolvedForTesting(
1258 const base::Closure& callback) { 1276 const base::Closure& callback) {
1259 if (timezone_resolved_) 1277 if (timezone_resolved_)
1260 return false; 1278 return false;
1261 1279
1262 on_timezone_resolved_for_testing_ = callback; 1280 on_timezone_resolved_for_testing_ = callback;
1263 return true; 1281 return true;
1264 } 1282 }
1265 1283
1266 } // namespace chromeos 1284 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.h ('k') | chrome/browser/chromeos/policy/device_cloud_policy_initializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698