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

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: 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 EnrollmentScreenActor::ENROLLMENT_MODE_MANUAL; 497 EnrollmentScreenActor::ENROLLMENT_MODE_MANUAL;
496 if (is_auto_enrollment) 498 EnrollmentScreen* screen = GetEnrollmentScreen();
499 std::string enrollment_domain = GetForcedEnrollmentDomain();
500 if (is_auto_enrollment) {
497 mode = EnrollmentScreenActor::ENROLLMENT_MODE_AUTO; 501 mode = EnrollmentScreenActor::ENROLLMENT_MODE_AUTO;
498 else if (ShouldAutoStartEnrollment() && !CanExitEnrollment()) 502 } else if (ShouldAutoStartEnrollment() && !CanExitEnrollment()) {
499 mode = EnrollmentScreenActor::ENROLLMENT_MODE_FORCED; 503 mode = EnrollmentScreenActor::ENROLLMENT_MODE_FORCED;
500 else if (ShouldRecoverEnrollment()) 504 } else if (enrollment_recovery_) {
501 mode = EnrollmentScreenActor::ENROLLMENT_MODE_FORCED; 505 mode = EnrollmentScreenActor::ENROLLMENT_MODE_FORCED;
506 enrollment_domain = GetEnrollmentRecoveryDomain();
507 }
502 508
503 EnrollmentScreen* screen = GetEnrollmentScreen(); 509 screen->SetParameters(mode, enrollment_domain, user);
504 screen->SetParameters(mode, GetForcedEnrollmentDomain(), user);
505 SetCurrentScreen(screen); 510 SetCurrentScreen(screen);
506 } 511 }
507 512
508 void WizardController::ShowResetScreen() { 513 void WizardController::ShowResetScreen() {
509 VLOG(1) << "Showing reset screen."; 514 VLOG(1) << "Showing reset screen.";
510 SetStatusAreaVisible(false); 515 SetStatusAreaVisible(false);
511 SetCurrentScreen(GetResetScreen()); 516 SetCurrentScreen(GetResetScreen());
512 } 517 }
513 518
514 void WizardController::ShowKioskEnableScreen() { 519 void WizardController::ShowKioskEnableScreen() {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 host_ = NULL; 729 host_ = NULL;
725 } 730 }
726 731
727 void WizardController::OnUserImageSkipped() { 732 void WizardController::OnUserImageSkipped() {
728 OnUserImageSelected(); 733 OnUserImageSelected();
729 } 734 }
730 735
731 void WizardController::OnEnrollmentDone() { 736 void WizardController::OnEnrollmentDone() {
732 // 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
733 // forced flow (i.e. app kiosk). 738 // forced flow (i.e. app kiosk).
734 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) 739 if (ShouldAutoStartEnrollment() || enrollment_recovery_)
735 PerformOOBECompletedActions(); 740 PerformOOBECompletedActions();
736 741
737 // 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
738 // 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.
739 if (KioskAppManager::Get()->IsAutoLaunchEnabled()) 744 if (KioskAppManager::Get()->IsAutoLaunchEnabled())
740 AutoLaunchKioskApp(); 745 AutoLaunchKioskApp();
741 else 746 else
742 ShowLoginScreen(LoginScreenContext()); 747 ShowLoginScreen(LoginScreenContext());
743 } 748 }
744 749
(...skipping 24 matching lines...) Expand all
769 else 774 else
770 ShowLoginScreen(LoginScreenContext()); 775 ShowLoginScreen(LoginScreenContext());
771 } 776 }
772 777
773 void WizardController::OnAutoEnrollmentDone() { 778 void WizardController::OnAutoEnrollmentDone() {
774 VLOG(1) << "Automagic enrollment done, resuming previous signin"; 779 VLOG(1) << "Automagic enrollment done, resuming previous signin";
775 ResumeLoginScreen(); 780 ResumeLoginScreen();
776 } 781 }
777 782
778 void WizardController::OnOOBECompleted() { 783 void WizardController::OnOOBECompleted() {
779 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) { 784 if (ShouldAutoStartEnrollment() || enrollment_recovery_) {
780 ShowEnrollmentScreen(); 785 ShowEnrollmentScreen();
781 } else { 786 } else {
782 PerformOOBECompletedActions(); 787 PerformOOBECompletedActions();
783 ShowLoginScreen(LoginScreenContext()); 788 ShowLoginScreen(LoginScreenContext());
784 } 789 }
785 } 790 }
786 791
787 void WizardController::OnTermsOfServiceDeclined() { 792 void WizardController::OnTermsOfServiceDeclined() {
788 // 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
789 // the login screen. 794 // the login screen.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 host_->PrewarmAuthentication(); 842 host_->PrewarmAuthentication();
838 NetworkPortalDetector::Get()->Enable(true); 843 NetworkPortalDetector::Get()->Enable(true);
839 } 844 }
840 845
841 void WizardController::PerformOOBECompletedActions() { 846 void WizardController::PerformOOBECompletedActions() {
842 UMA_HISTOGRAM_COUNTS_100( 847 UMA_HISTOGRAM_COUNTS_100(
843 "HIDDetection.TimesDialogShownPerOOBECompleted", 848 "HIDDetection.TimesDialogShownPerOOBECompleted",
844 GetLocalState()->GetInteger(prefs::kTimesHIDDialogShown)); 849 GetLocalState()->GetInteger(prefs::kTimesHIDDialogShown));
845 GetLocalState()->ClearPref(prefs::kTimesHIDDialogShown); 850 GetLocalState()->ClearPref(prefs::kTimesHIDDialogShown);
846 StartupUtils::MarkOobeCompleted(); 851 StartupUtils::MarkOobeCompleted();
852
853 if (enrollment_recovery_)
854 chrome::AttemptRestart();
847 } 855 }
848 856
849 void WizardController::SetCurrentScreen(WizardScreen* new_current) { 857 void WizardController::SetCurrentScreen(WizardScreen* new_current) {
850 SetCurrentScreenSmooth(new_current, false); 858 SetCurrentScreenSmooth(new_current, false);
851 } 859 }
852 860
853 void WizardController::ShowCurrentScreen() { 861 void WizardController::ShowCurrentScreen() {
854 // ShowCurrentScreen may get called by smooth_show_timer_ even after 862 // ShowCurrentScreen may get called by smooth_show_timer_ even after
855 // flow has been switched to sign in screen (ExistingUserController). 863 // flow has been switched to sign in screen (ExistingUserController).
856 if (!oobe_display_) 864 if (!oobe_display_)
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 // static 1143 // static
1136 bool WizardController::ShouldRecoverEnrollment() { 1144 bool WizardController::ShouldRecoverEnrollment() {
1137 policy::BrowserPolicyConnectorChromeOS* connector = 1145 policy::BrowserPolicyConnectorChromeOS* connector =
1138 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 1146 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1139 policy::DeviceCloudPolicyInitializer* dcp_initializer = 1147 policy::DeviceCloudPolicyInitializer* dcp_initializer =
1140 connector->GetDeviceCloudPolicyInitializer(); 1148 connector->GetDeviceCloudPolicyInitializer();
1141 return dcp_initializer && dcp_initializer->ShouldRecoverEnrollment(); 1149 return dcp_initializer && dcp_initializer->ShouldRecoverEnrollment();
1142 } 1150 }
1143 1151
1144 // 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) return std::string();
pastarmovj 2014/07/15 08:44:10 nit: line break.
Thiemo Nagel 2014/07/16 09:55:32 Done.
1159 return dcp_initializer->GetEnrollmentRecoveryDomain();
1160 }
1161
1162 // static
1145 bool WizardController::CanExitEnrollment() { 1163 bool WizardController::CanExitEnrollment() {
1146 policy::BrowserPolicyConnectorChromeOS* connector = 1164 policy::BrowserPolicyConnectorChromeOS* connector =
1147 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 1165 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1148 CHECK(connector); 1166 CHECK(connector);
1149 return connector->GetDeviceCloudPolicyInitializer()->CanExitEnrollment(); 1167 return connector->GetDeviceCloudPolicyInitializer()->CanExitEnrollment();
1150 } 1168 }
1151 1169
1152 // static 1170 // static
1153 std::string WizardController::GetForcedEnrollmentDomain() { 1171 std::string WizardController::GetForcedEnrollmentDomain() {
1154 policy::BrowserPolicyConnectorChromeOS* connector = 1172 policy::BrowserPolicyConnectorChromeOS* connector =
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 bool WizardController::SetOnTimeZoneResolvedForTesting( 1274 bool WizardController::SetOnTimeZoneResolvedForTesting(
1257 const base::Closure& callback) { 1275 const base::Closure& callback) {
1258 if (timezone_resolved_) 1276 if (timezone_resolved_)
1259 return false; 1277 return false;
1260 1278
1261 on_timezone_resolved_for_testing_ = callback; 1279 on_timezone_resolved_for_testing_ = callback;
1262 return true; 1280 return true;
1263 } 1281 }
1264 1282
1265 } // namespace chromeos 1283 } // 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