Chromium Code Reviews| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 using content::BrowserThread; | 95 using content::BrowserThread; |
| 96 | 96 |
| 97 namespace { | 97 namespace { |
| 98 // Interval in ms which is used for smooth screen showing. | 98 // Interval in ms which is used for smooth screen showing. |
| 99 static int kShowDelayMs = 400; | 99 static int kShowDelayMs = 400; |
| 100 | 100 |
| 101 // Total timezone resolving process timeout. | 101 // Total timezone resolving process timeout. |
| 102 const unsigned int kResolveTimeZoneTimeoutSeconds = 60; | 102 const unsigned int kResolveTimeZoneTimeoutSeconds = 60; |
| 103 | 103 |
| 104 // Stores the list of all screens that should be shown when resuming OOBE. | 104 // Stores the list of all screens that should be shown when resuming OOBE. |
| 105 const char* kResumableScreens[] = { | 105 const chromeos::OobeScreen kResumableScreens[] = { |
| 106 chromeos::WizardController::kNetworkScreenName, | 106 chromeos::OobeScreen::SCREEN_OOBE_NETWORK, |
| 107 chromeos::WizardController::kUpdateScreenName, | 107 chromeos::OobeScreen::SCREEN_OOBE_UPDATE, |
| 108 chromeos::WizardController::kEulaScreenName, | 108 chromeos::OobeScreen::SCREEN_OOBE_EULA, |
| 109 chromeos::WizardController::kEnrollmentScreenName, | 109 chromeos::OobeScreen::SCREEN_OOBE_ENROLLMENT, |
| 110 chromeos::WizardController::kTermsOfServiceScreenName, | 110 chromeos::OobeScreen::SCREEN_TERMS_OF_SERVICE, |
| 111 chromeos::WizardController::kArcTermsOfServiceScreenName, | 111 chromeos::OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE, |
| 112 chromeos::WizardController::kAutoEnrollmentCheckScreenName}; | 112 chromeos::OobeScreen::SCREEN_AUTO_ENROLLMENT_CHECK}; |
| 113 | 113 |
| 114 // Checks flag for HID-detection screen show. | 114 // Checks flag for HID-detection screen show. |
| 115 bool CanShowHIDDetectionScreen() { | 115 bool CanShowHIDDetectionScreen() { |
| 116 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 116 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 117 chromeos::switches::kDisableHIDDetectionOnOOBE); | 117 chromeos::switches::kDisableHIDDetectionOnOOBE); |
| 118 } | 118 } |
| 119 | 119 |
| 120 bool IsResumableScreen(const std::string& screen) { | 120 bool IsResumableScreen(chromeos::OobeScreen screen) { |
| 121 for (size_t i = 0; i < arraysize(kResumableScreens); ++i) { | 121 for (size_t i = 0; i < arraysize(kResumableScreens); ++i) { |
| 122 if (screen == kResumableScreens[i]) | 122 if (screen == kResumableScreens[i]) |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 return false; | 125 return false; |
| 126 } | 126 } |
| 127 | 127 |
| 128 void RecordUMAHistogramForOOBEStepCompletionTime(std::string screen_name, | 128 void RecordUMAHistogramForOOBEStepCompletionTime(chromeos::OobeScreen screen, |
| 129 base::TimeDelta step_time) { | 129 base::TimeDelta step_time) { |
| 130 // Fetch screen name. Some of the screens had multiple different names in the | |
| 131 // past which have been unified. We need to use the old names though when | |
| 132 // recording UMA histograms. | |
| 133 std::string screen_name = chromeos::GetOobeScreenName(screen); | |
| 134 if (screen == chromeos::OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE) | |
| 135 screen_name = "arc_tos"; | |
| 136 else if (screen == chromeos::OobeScreen::SCREEN_OOBE_ENROLLMENT) | |
| 137 screen_name = "enroll"; | |
| 138 else if (screen == chromeos::OobeScreen::SCREEN_OOBE_NETWORK) | |
| 139 screen_name = "network"; | |
| 140 else if (screen == chromeos::OobeScreen::SCREEN_CREATE_SUPERVISED_USER_FLOW) | |
| 141 screen_name = "supervised-user-creation-flow"; | |
| 142 else if (screen == chromeos::OobeScreen::SCREEN_TERMS_OF_SERVICE) | |
| 143 screen_name = "tos"; | |
| 144 else if (screen == chromeos::OobeScreen::SCREEN_USER_IMAGE_PICKER) | |
| 145 screen_name = "image"; | |
| 146 | |
|
Alexander Alekseev
2016/12/13 03:08:05
Why is the full set of names not supported now?
jdufault
2016/12/13 22:30:27
The full set of names is being used; these are jus
| |
| 130 screen_name[0] = std::toupper(screen_name[0]); | 147 screen_name[0] = std::toupper(screen_name[0]); |
| 131 std::string histogram_name = "OOBE.StepCompletionTime." + screen_name; | 148 std::string histogram_name = "OOBE.StepCompletionTime." + screen_name; |
| 132 // Equivalent to using UMA_HISTOGRAM_MEDIUM_TIMES. UMA_HISTOGRAM_MEDIUM_TIMES | 149 // Equivalent to using UMA_HISTOGRAM_MEDIUM_TIMES. UMA_HISTOGRAM_MEDIUM_TIMES |
| 133 // can not be used here, because |histogram_name| is calculated dynamically | 150 // can not be used here, because |histogram_name| is calculated dynamically |
| 134 // and changes from call to call. | 151 // and changes from call to call. |
| 135 base::HistogramBase* histogram = base::Histogram::FactoryTimeGet( | 152 base::HistogramBase* histogram = base::Histogram::FactoryTimeGet( |
| 136 histogram_name, | 153 histogram_name, |
| 137 base::TimeDelta::FromMilliseconds(10), | 154 base::TimeDelta::FromMilliseconds(10), |
| 138 base::TimeDelta::FromMinutes(3), | 155 base::TimeDelta::FromMinutes(3), |
| 139 50, | 156 50, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 // The crash reporter initialization needs IO to complete. | 214 // The crash reporter initialization needs IO to complete. |
| 198 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 215 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 199 breakpad::InitCrashReporter(std::string()); | 216 breakpad::InitCrashReporter(std::string()); |
| 200 } | 217 } |
| 201 #endif | 218 #endif |
| 202 | 219 |
| 203 } // namespace | 220 } // namespace |
| 204 | 221 |
| 205 namespace chromeos { | 222 namespace chromeos { |
| 206 | 223 |
| 207 const char WizardController::kNetworkScreenName[] = "network"; | |
| 208 const char WizardController::kLoginScreenName[] = "login"; | |
| 209 const char WizardController::kUpdateScreenName[] = "update"; | |
| 210 const char WizardController::kUserImageScreenName[] = "image"; | |
| 211 const char WizardController::kEulaScreenName[] = "eula"; | |
| 212 const char WizardController::kEnableDebuggingScreenName[] = "debugging"; | |
| 213 const char WizardController::kEnrollmentScreenName[] = "enroll"; | |
| 214 const char WizardController::kResetScreenName[] = "reset"; | |
| 215 const char WizardController::kKioskEnableScreenName[] = "kiosk-enable"; | |
| 216 const char WizardController::kKioskAutolaunchScreenName[] = "autolaunch"; | |
| 217 const char WizardController::kErrorScreenName[] = "error-message"; | |
| 218 const char WizardController::kTermsOfServiceScreenName[] = "tos"; | |
| 219 const char WizardController::kArcTermsOfServiceScreenName[] = "arc_tos"; | |
| 220 const char WizardController::kAutoEnrollmentCheckScreenName[] = | |
| 221 "auto-enrollment-check"; | |
| 222 const char WizardController::kWrongHWIDScreenName[] = "wrong-hwid"; | |
| 223 const char WizardController::kSupervisedUserCreationScreenName[] = | |
| 224 "supervised-user-creation-flow"; | |
| 225 const char WizardController::kAppLaunchSplashScreenName[] = | |
| 226 "app-launch-splash"; | |
| 227 const char WizardController::kHIDDetectionScreenName[] = "hid-detection"; | |
| 228 const char WizardController::kControllerPairingScreenName[] = | |
| 229 "controller-pairing"; | |
| 230 const char WizardController::kHostPairingScreenName[] = "host-pairing"; | |
| 231 const char WizardController::kDeviceDisabledScreenName[] = "device-disabled"; | |
| 232 | |
| 233 // static | 224 // static |
| 234 const int WizardController::kMinAudibleOutputVolumePercent = 10; | 225 const int WizardController::kMinAudibleOutputVolumePercent = 10; |
| 235 | 226 |
| 236 // Passing this parameter as a "first screen" initiates full OOBE flow. | |
| 237 const char WizardController::kOutOfBoxScreenName[] = "oobe"; | |
| 238 | |
| 239 // Special test value that commands not to create any window yet. | |
| 240 const char WizardController::kTestNoScreenName[] = "test:nowindow"; | |
| 241 | |
| 242 // Initialize default controller. | 227 // Initialize default controller. |
| 243 // static | 228 // static |
| 244 WizardController* WizardController::default_controller_ = nullptr; | 229 WizardController* WizardController::default_controller_ = nullptr; |
| 245 | 230 |
| 246 // static | 231 // static |
| 247 bool WizardController::skip_post_login_screens_ = false; | 232 bool WizardController::skip_post_login_screens_ = false; |
| 248 | 233 |
| 249 // static | 234 // static |
| 250 bool WizardController::zero_delay_enabled_ = false; | 235 bool WizardController::zero_delay_enabled_ = false; |
| 251 | 236 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 274 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( | 259 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( |
| 275 FROM_HERE, shark_connection_listener_.release()); | 260 FROM_HERE, shark_connection_listener_.release()); |
| 276 } | 261 } |
| 277 if (default_controller_ == this) { | 262 if (default_controller_ == this) { |
| 278 default_controller_ = nullptr; | 263 default_controller_ = nullptr; |
| 279 } else { | 264 } else { |
| 280 NOTREACHED() << "More than one controller are alive."; | 265 NOTREACHED() << "More than one controller are alive."; |
| 281 } | 266 } |
| 282 } | 267 } |
| 283 | 268 |
| 284 void WizardController::Init(const std::string& first_screen_name) { | 269 void WizardController::Init(OobeScreen first_screen_name) { |
| 285 VLOG(1) << "Starting OOBE wizard with screen: " << first_screen_name; | 270 VLOG(1) << "Starting OOBE wizard with screen: " |
| 271 << GetOobeScreenName(first_screen_name); | |
| 286 first_screen_name_ = first_screen_name; | 272 first_screen_name_ = first_screen_name; |
| 287 | 273 |
| 288 bool oobe_complete = StartupUtils::IsOobeCompleted(); | 274 bool oobe_complete = StartupUtils::IsOobeCompleted(); |
| 289 if (!oobe_complete || first_screen_name == kOutOfBoxScreenName) | 275 if (!oobe_complete || first_screen_name == OobeScreen::SCREEN_SPECIAL_OOBE) |
| 290 is_out_of_box_ = true; | 276 is_out_of_box_ = true; |
| 291 | 277 |
| 292 // This is a hacky way to check for local state corruption, because | 278 // This is a hacky way to check for local state corruption, because |
| 293 // it depends on the fact that the local state is loaded | 279 // it depends on the fact that the local state is loaded |
| 294 // synchronously and at the first demand. IsEnterpriseManaged() | 280 // synchronously and at the first demand. IsEnterpriseManaged() |
| 295 // check is required because currently powerwash is disabled for | 281 // check is required because currently powerwash is disabled for |
| 296 // enterprise-enrolled devices. | 282 // enterprise-enrolled devices. |
| 297 // | 283 // |
| 298 // TODO (ygorshenin@): implement handling of the local state | 284 // TODO (ygorshenin@): implement handling of the local state |
| 299 // corruption in the case of asynchronious loading. | 285 // corruption in the case of asynchronious loading. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 315 // If the device is a Master device in bootstrapping process (mostly for demo | 301 // If the device is a Master device in bootstrapping process (mostly for demo |
| 316 // and test purpose), start the enrollment OOBE flow. | 302 // and test purpose), start the enrollment OOBE flow. |
| 317 if (IsBootstrappingMaster()) | 303 if (IsBootstrappingMaster()) |
| 318 connector->GetDeviceCloudPolicyManager()->SetDeviceEnrollmentAutoStart(); | 304 connector->GetDeviceCloudPolicyManager()->SetDeviceEnrollmentAutoStart(); |
| 319 | 305 |
| 320 // Use the saved screen preference from Local State. | 306 // Use the saved screen preference from Local State. |
| 321 const std::string screen_pref = | 307 const std::string screen_pref = |
| 322 GetLocalState()->GetString(prefs::kOobeScreenPending); | 308 GetLocalState()->GetString(prefs::kOobeScreenPending); |
| 323 if (is_out_of_box_ && !screen_pref.empty() && !IsRemoraPairingOobe() && | 309 if (is_out_of_box_ && !screen_pref.empty() && !IsRemoraPairingOobe() && |
| 324 !IsControllerDetected() && | 310 !IsControllerDetected() && |
| 325 (first_screen_name.empty() || | 311 (first_screen_name == OobeScreen::SCREEN_UNKNOWN || |
| 326 first_screen_name == WizardController::kTestNoScreenName)) { | 312 first_screen_name == OobeScreen::SCREEN_TEST_NO_WINDOW)) { |
| 327 first_screen_name_ = screen_pref; | 313 first_screen_name_ = GetOobeScreenFromName(screen_pref); |
| 328 } | 314 } |
| 329 // We need to reset the kOobeControllerDetected pref to allow the user to have | 315 // We need to reset the kOobeControllerDetected pref to allow the user to have |
| 330 // the choice to setup the device manually. The pref will be set properly if | 316 // the choice to setup the device manually. The pref will be set properly if |
| 331 // an eligible controller is detected later. | 317 // an eligible controller is detected later. |
| 332 SetControllerDetectedPref(false); | 318 SetControllerDetectedPref(false); |
| 333 | 319 |
| 334 // Show Material Design unless explicitly disabled or for an untested UX, | 320 // Show Material Design unless explicitly disabled or for an untested UX, |
| 335 // or when resuming an OOBE that had it disabled or unset. We use an if/else | 321 // or when resuming an OOBE that had it disabled or unset. We use an if/else |
| 336 // here to try and not set state when it is the default value so it can | 322 // here to try and not set state when it is the default value so it can |
| 337 // change and affect the OOBE again. | 323 // change and affect the OOBE again. |
| 338 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 324 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 339 chromeos::switches::kDisableMdOobe)) | 325 chromeos::switches::kDisableMdOobe)) |
| 340 SetShowMdOobe(false); | 326 SetShowMdOobe(false); |
| 341 else if ((screen_pref.empty() || | 327 else if ((screen_pref.empty() || |
| 342 GetLocalState()->HasPrefPath(prefs::kOobeMdMode)) || | 328 GetLocalState()->HasPrefPath(prefs::kOobeMdMode)) || |
| 343 GetLocalState()->GetBoolean(prefs::kOobeMdMode)) | 329 GetLocalState()->GetBoolean(prefs::kOobeMdMode)) |
| 344 SetShowMdOobe(true); | 330 SetShowMdOobe(true); |
| 345 | 331 |
| 346 // TODO(drcrash): Remove this after testing (http://crbug.com/647411). | 332 // TODO(drcrash): Remove this after testing (http://crbug.com/647411). |
| 347 if (IsRemoraPairingOobe() || IsSharkRequisition() || IsRemoraRequisition()) { | 333 if (IsRemoraPairingOobe() || IsSharkRequisition() || IsRemoraRequisition()) { |
| 348 SetShowMdOobe(false); | 334 SetShowMdOobe(false); |
| 349 } | 335 } |
| 350 | 336 |
| 351 AdvanceToScreen(first_screen_name_); | 337 AdvanceToScreen(first_screen_name_); |
| 352 if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() && | 338 if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() && |
| 353 first_screen_name_.empty()) | 339 first_screen_name_ == OobeScreen::SCREEN_UNKNOWN) |
| 354 ShowWrongHWIDScreen(); | 340 ShowWrongHWIDScreen(); |
| 355 } | 341 } |
| 356 | 342 |
| 357 ErrorScreen* WizardController::GetErrorScreen() { | 343 ErrorScreen* WizardController::GetErrorScreen() { |
| 358 return oobe_ui_->GetErrorScreen(); | 344 return oobe_ui_->GetErrorScreen(); |
| 359 } | 345 } |
| 360 | 346 |
| 361 BaseScreen* WizardController::GetScreen(const std::string& screen_name) { | 347 BaseScreen* WizardController::GetScreen(OobeScreen screen) { |
| 362 if (screen_name == kErrorScreenName) | 348 if (screen == OobeScreen::SCREEN_ERROR_MESSAGE) |
| 363 return GetErrorScreen(); | 349 return GetErrorScreen(); |
| 364 return ScreenManager::GetScreen(screen_name); | 350 return ScreenManager::GetScreen(screen); |
| 365 } | 351 } |
| 366 | 352 |
| 367 BaseScreen* WizardController::CreateScreen(const std::string& screen_name) { | 353 BaseScreen* WizardController::CreateScreen(OobeScreen screen) { |
| 368 if (screen_name == kNetworkScreenName) { | 354 if (screen == OobeScreen::SCREEN_OOBE_NETWORK) { |
| 369 std::unique_ptr<NetworkScreen> screen( | 355 std::unique_ptr<NetworkScreen> screen( |
| 370 new NetworkScreen(this, this, oobe_ui_->GetNetworkView())); | 356 new NetworkScreen(this, this, oobe_ui_->GetNetworkView())); |
| 371 screen->Initialize(nullptr /* context */); | 357 screen->Initialize(nullptr /* context */); |
| 372 return screen.release(); | 358 return screen.release(); |
| 373 } else if (screen_name == kUpdateScreenName) { | 359 } else if (screen == OobeScreen::SCREEN_OOBE_UPDATE) { |
| 374 std::unique_ptr<UpdateScreen> screen(new UpdateScreen( | 360 std::unique_ptr<UpdateScreen> screen(new UpdateScreen( |
| 375 this, oobe_ui_->GetUpdateView(), remora_controller_.get())); | 361 this, oobe_ui_->GetUpdateView(), remora_controller_.get())); |
| 376 screen->Initialize(nullptr /* context */); | 362 screen->Initialize(nullptr /* context */); |
| 377 return screen.release(); | 363 return screen.release(); |
| 378 } else if (screen_name == kUserImageScreenName) { | 364 } else if (screen == OobeScreen::SCREEN_USER_IMAGE_PICKER) { |
| 379 return new UserImageScreen(this, oobe_ui_->GetUserImageView()); | 365 return new UserImageScreen(this, oobe_ui_->GetUserImageView()); |
| 380 } else if (screen_name == kEulaScreenName) { | 366 } else if (screen == OobeScreen::SCREEN_OOBE_EULA) { |
| 381 return new EulaScreen(this, this, oobe_ui_->GetEulaView()); | 367 return new EulaScreen(this, this, oobe_ui_->GetEulaView()); |
| 382 } else if (screen_name == kEnrollmentScreenName) { | 368 } else if (screen == OobeScreen::SCREEN_OOBE_ENROLLMENT) { |
| 383 return new EnrollmentScreen(this, oobe_ui_->GetEnrollmentScreenActor()); | 369 return new EnrollmentScreen(this, oobe_ui_->GetEnrollmentScreenActor()); |
| 384 } else if (screen_name == kResetScreenName) { | 370 } else if (screen == OobeScreen::SCREEN_OOBE_RESET) { |
| 385 return new chromeos::ResetScreen(this, oobe_ui_->GetResetView()); | 371 return new chromeos::ResetScreen(this, oobe_ui_->GetResetView()); |
| 386 } else if (screen_name == kEnableDebuggingScreenName) { | 372 } else if (screen == OobeScreen::SCREEN_OOBE_ENABLE_DEBUGGING) { |
| 387 return new EnableDebuggingScreen(this, | 373 return new EnableDebuggingScreen(this, |
| 388 oobe_ui_->GetEnableDebuggingScreenActor()); | 374 oobe_ui_->GetEnableDebuggingScreenActor()); |
| 389 } else if (screen_name == kKioskEnableScreenName) { | 375 } else if (screen == OobeScreen::SCREEN_KIOSK_ENABLE) { |
| 390 return new KioskEnableScreen(this, oobe_ui_->GetKioskEnableScreenActor()); | 376 return new KioskEnableScreen(this, oobe_ui_->GetKioskEnableScreenActor()); |
| 391 } else if (screen_name == kKioskAutolaunchScreenName) { | 377 } else if (screen == OobeScreen::SCREEN_KIOSK_AUTOLAUNCH) { |
| 392 return new KioskAutolaunchScreen(this, | 378 return new KioskAutolaunchScreen(this, |
| 393 oobe_ui_->GetKioskAutolaunchScreenActor()); | 379 oobe_ui_->GetKioskAutolaunchScreenActor()); |
| 394 } else if (screen_name == kTermsOfServiceScreenName) { | 380 } else if (screen == OobeScreen::SCREEN_TERMS_OF_SERVICE) { |
| 395 return new TermsOfServiceScreen(this, | 381 return new TermsOfServiceScreen(this, |
| 396 oobe_ui_->GetTermsOfServiceScreenActor()); | 382 oobe_ui_->GetTermsOfServiceScreenActor()); |
| 397 } else if (screen_name == kArcTermsOfServiceScreenName) { | 383 } else if (screen == OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE) { |
| 398 return new ArcTermsOfServiceScreen( | 384 return new ArcTermsOfServiceScreen( |
| 399 this, oobe_ui_->GetArcTermsOfServiceScreenActor()); | 385 this, oobe_ui_->GetArcTermsOfServiceScreenActor()); |
| 400 } else if (screen_name == kWrongHWIDScreenName) { | 386 } else if (screen == OobeScreen::SCREEN_WRONG_HWID) { |
| 401 return new WrongHWIDScreen(this, oobe_ui_->GetWrongHWIDScreenActor()); | 387 return new WrongHWIDScreen(this, oobe_ui_->GetWrongHWIDScreenActor()); |
| 402 } else if (screen_name == kSupervisedUserCreationScreenName) { | 388 } else if (screen == OobeScreen::SCREEN_CREATE_SUPERVISED_USER_FLOW) { |
| 403 return new SupervisedUserCreationScreen( | 389 return new SupervisedUserCreationScreen( |
| 404 this, oobe_ui_->GetSupervisedUserCreationScreenActor()); | 390 this, oobe_ui_->GetSupervisedUserCreationScreenActor()); |
| 405 } else if (screen_name == kHIDDetectionScreenName) { | 391 } else if (screen == OobeScreen::SCREEN_OOBE_HID_DETECTION) { |
| 406 std::unique_ptr<HIDDetectionScreen> screen(new chromeos::HIDDetectionScreen( | 392 std::unique_ptr<HIDDetectionScreen> screen(new chromeos::HIDDetectionScreen( |
| 407 this, oobe_ui_->GetHIDDetectionView())); | 393 this, oobe_ui_->GetHIDDetectionView())); |
| 408 screen->Initialize(nullptr /* context */); | 394 screen->Initialize(nullptr /* context */); |
| 409 return screen.release(); | 395 return screen.release(); |
| 410 } else if (screen_name == kAutoEnrollmentCheckScreenName) { | 396 } else if (screen == OobeScreen::SCREEN_AUTO_ENROLLMENT_CHECK) { |
| 411 return new AutoEnrollmentCheckScreen( | 397 return new AutoEnrollmentCheckScreen( |
| 412 this, oobe_ui_->GetAutoEnrollmentCheckScreenActor()); | 398 this, oobe_ui_->GetAutoEnrollmentCheckScreenActor()); |
| 413 } else if (screen_name == kControllerPairingScreenName) { | 399 } else if (screen == OobeScreen::SCREEN_OOBE_CONTROLLER_PAIRING) { |
| 414 if (!shark_controller_) { | 400 if (!shark_controller_) { |
| 415 shark_controller_.reset( | 401 shark_controller_.reset( |
| 416 new pairing_chromeos::BluetoothControllerPairingController()); | 402 new pairing_chromeos::BluetoothControllerPairingController()); |
| 417 } | 403 } |
| 418 return new ControllerPairingScreen( | 404 return new ControllerPairingScreen( |
| 419 this, this, oobe_ui_->GetControllerPairingScreenActor(), | 405 this, this, oobe_ui_->GetControllerPairingScreenActor(), |
| 420 shark_controller_.get()); | 406 shark_controller_.get()); |
| 421 } else if (screen_name == kHostPairingScreenName) { | 407 } else if (screen == OobeScreen::SCREEN_OOBE_HOST_PAIRING) { |
| 422 if (!remora_controller_) { | 408 if (!remora_controller_) { |
| 423 remora_controller_.reset( | 409 remora_controller_.reset( |
| 424 new pairing_chromeos::BluetoothHostPairingController( | 410 new pairing_chromeos::BluetoothHostPairingController( |
| 425 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); | 411 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); |
| 426 remora_controller_->StartPairing(); | 412 remora_controller_->StartPairing(); |
| 427 } | 413 } |
| 428 return new HostPairingScreen(this, this, | 414 return new HostPairingScreen(this, this, |
| 429 oobe_ui_->GetHostPairingScreenActor(), | 415 oobe_ui_->GetHostPairingScreenActor(), |
| 430 remora_controller_.get()); | 416 remora_controller_.get()); |
| 431 } else if (screen_name == kDeviceDisabledScreenName) { | 417 } else if (screen == OobeScreen::SCREEN_DEVICE_DISABLED) { |
| 432 return new DeviceDisabledScreen(this, | 418 return new DeviceDisabledScreen(this, |
| 433 oobe_ui_->GetDeviceDisabledScreenActor()); | 419 oobe_ui_->GetDeviceDisabledScreenActor()); |
| 434 } | 420 } |
| 435 | 421 |
| 436 return nullptr; | 422 return nullptr; |
| 437 } | 423 } |
| 438 | 424 |
| 439 void WizardController::ShowNetworkScreen() { | 425 void WizardController::ShowNetworkScreen() { |
| 440 VLOG(1) << "Showing network screen."; | 426 VLOG(1) << "Showing network screen."; |
| 441 // Hide the status area initially; it only appears after OOBE first animates | 427 // Hide the status area initially; it only appears after OOBE first animates |
| 442 // in. Keep it visible if the user goes back to the existing network screen. | 428 // in. Keep it visible if the user goes back to the existing network screen. |
| 443 SetStatusAreaVisible(HasScreen(kNetworkScreenName)); | 429 SetStatusAreaVisible(HasScreen(OobeScreen::SCREEN_OOBE_NETWORK)); |
| 444 SetCurrentScreen(GetScreen(kNetworkScreenName)); | 430 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_OOBE_NETWORK)); |
| 445 | 431 |
| 446 // There are two possible screens where we listen to the incoming Bluetooth | 432 // There are two possible screens where we listen to the incoming Bluetooth |
| 447 // connection request: the first one is the HID detection screen, which will | 433 // connection request: the first one is the HID detection screen, which will |
| 448 // show up when there is no sufficient input devices. In this case, we just | 434 // show up when there is no sufficient input devices. In this case, we just |
| 449 // keep the logic as it is today: always put the Bluetooth is discoverable | 435 // keep the logic as it is today: always put the Bluetooth is discoverable |
| 450 // mode. The other place is the Network screen (here), which will show up when | 436 // mode. The other place is the Network screen (here), which will show up when |
| 451 // there are input devices detected. In this case, we disable the Bluetooth by | 437 // there are input devices detected. In this case, we disable the Bluetooth by |
| 452 // default until the user explicitly enable it by pressing a key combo (Ctrl+ | 438 // default until the user explicitly enable it by pressing a key combo (Ctrl+ |
| 453 // Alt+Shift+S). | 439 // Alt+Shift+S). |
| 454 if (IsBootstrappingSlave()) | 440 if (IsBootstrappingSlave()) |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 467 VLOG(1) << "Showing login screen."; | 453 VLOG(1) << "Showing login screen."; |
| 468 SetStatusAreaVisible(true); | 454 SetStatusAreaVisible(true); |
| 469 host_->StartSignInScreen(context); | 455 host_->StartSignInScreen(context); |
| 470 smooth_show_timer_.Stop(); | 456 smooth_show_timer_.Stop(); |
| 471 login_screen_started_ = true; | 457 login_screen_started_ = true; |
| 472 } | 458 } |
| 473 | 459 |
| 474 void WizardController::ShowUpdateScreen() { | 460 void WizardController::ShowUpdateScreen() { |
| 475 VLOG(1) << "Showing update screen."; | 461 VLOG(1) << "Showing update screen."; |
| 476 SetStatusAreaVisible(true); | 462 SetStatusAreaVisible(true); |
| 477 SetCurrentScreen(GetScreen(kUpdateScreenName)); | 463 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_OOBE_UPDATE)); |
| 478 } | 464 } |
| 479 | 465 |
| 480 void WizardController::ShowUserImageScreen() { | 466 void WizardController::ShowUserImageScreen() { |
| 481 const user_manager::UserManager* user_manager = | 467 const user_manager::UserManager* user_manager = |
| 482 user_manager::UserManager::Get(); | 468 user_manager::UserManager::Get(); |
| 483 // Skip user image selection for public sessions and ephemeral non-regual user | 469 // Skip user image selection for public sessions and ephemeral non-regual user |
| 484 // logins. | 470 // logins. |
| 485 if (user_manager->IsLoggedInAsPublicAccount() || | 471 if (user_manager->IsLoggedInAsPublicAccount() || |
| 486 (user_manager->IsCurrentUserNonCryptohomeDataEphemeral() && | 472 (user_manager->IsCurrentUserNonCryptohomeDataEphemeral() && |
| 487 user_manager->GetActiveUser()->GetType() != | 473 user_manager->GetActiveUser()->GetType() != |
| 488 user_manager::USER_TYPE_REGULAR)) { | 474 user_manager::USER_TYPE_REGULAR)) { |
| 489 OnUserImageSkipped(); | 475 OnUserImageSkipped(); |
| 490 return; | 476 return; |
| 491 } | 477 } |
| 492 VLOG(1) << "Showing user image screen."; | 478 VLOG(1) << "Showing user image screen."; |
| 493 | 479 |
| 494 // Status area has been already shown at sign in screen so it | 480 // Status area has been already shown at sign in screen so it |
| 495 // doesn't make sense to hide it here and then show again at user session as | 481 // doesn't make sense to hide it here and then show again at user session as |
| 496 // this produces undesired UX transitions. | 482 // this produces undesired UX transitions. |
| 497 SetStatusAreaVisible(true); | 483 SetStatusAreaVisible(true); |
| 498 | 484 |
| 499 SetCurrentScreen(GetScreen(kUserImageScreenName)); | 485 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_USER_IMAGE_PICKER)); |
| 500 } | 486 } |
| 501 | 487 |
| 502 void WizardController::ShowEulaScreen() { | 488 void WizardController::ShowEulaScreen() { |
| 503 VLOG(1) << "Showing EULA screen."; | 489 VLOG(1) << "Showing EULA screen."; |
| 504 SetStatusAreaVisible(true); | 490 SetStatusAreaVisible(true); |
| 505 SetCurrentScreen(GetScreen(kEulaScreenName)); | 491 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_OOBE_EULA)); |
| 506 } | 492 } |
| 507 | 493 |
| 508 void WizardController::ShowEnrollmentScreen() { | 494 void WizardController::ShowEnrollmentScreen() { |
| 509 // Update the enrollment configuration and start the screen. | 495 // Update the enrollment configuration and start the screen. |
| 510 prescribed_enrollment_config_ = g_browser_process->platform_part() | 496 prescribed_enrollment_config_ = g_browser_process->platform_part() |
| 511 ->browser_policy_connector_chromeos() | 497 ->browser_policy_connector_chromeos() |
| 512 ->GetPrescribedEnrollmentConfig(); | 498 ->GetPrescribedEnrollmentConfig(); |
| 513 StartEnrollmentScreen(false); | 499 StartEnrollmentScreen(false); |
| 514 } | 500 } |
| 515 | 501 |
| 516 void WizardController::ShowResetScreen() { | 502 void WizardController::ShowResetScreen() { |
| 517 VLOG(1) << "Showing reset screen."; | 503 VLOG(1) << "Showing reset screen."; |
| 518 SetStatusAreaVisible(false); | 504 SetStatusAreaVisible(false); |
| 519 SetCurrentScreen(GetScreen(kResetScreenName)); | 505 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_OOBE_RESET)); |
| 520 } | 506 } |
| 521 | 507 |
| 522 void WizardController::ShowKioskEnableScreen() { | 508 void WizardController::ShowKioskEnableScreen() { |
| 523 VLOG(1) << "Showing kiosk enable screen."; | 509 VLOG(1) << "Showing kiosk enable screen."; |
| 524 SetStatusAreaVisible(false); | 510 SetStatusAreaVisible(false); |
| 525 SetCurrentScreen(GetScreen(kKioskEnableScreenName)); | 511 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_KIOSK_ENABLE)); |
| 526 } | 512 } |
| 527 | 513 |
| 528 void WizardController::ShowKioskAutolaunchScreen() { | 514 void WizardController::ShowKioskAutolaunchScreen() { |
| 529 VLOG(1) << "Showing kiosk autolaunch screen."; | 515 VLOG(1) << "Showing kiosk autolaunch screen."; |
| 530 SetStatusAreaVisible(false); | 516 SetStatusAreaVisible(false); |
| 531 SetCurrentScreen(GetScreen(kKioskAutolaunchScreenName)); | 517 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_KIOSK_AUTOLAUNCH)); |
| 532 } | 518 } |
| 533 | 519 |
| 534 void WizardController::ShowEnableDebuggingScreen() { | 520 void WizardController::ShowEnableDebuggingScreen() { |
| 535 VLOG(1) << "Showing enable developer features screen."; | 521 VLOG(1) << "Showing enable developer features screen."; |
| 536 SetStatusAreaVisible(false); | 522 SetStatusAreaVisible(false); |
| 537 SetCurrentScreen(GetScreen(kEnableDebuggingScreenName)); | 523 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_OOBE_ENABLE_DEBUGGING)); |
| 538 } | 524 } |
| 539 | 525 |
| 540 void WizardController::ShowTermsOfServiceScreen() { | 526 void WizardController::ShowTermsOfServiceScreen() { |
| 541 // Only show the Terms of Service when logging into a public account and Terms | 527 // Only show the Terms of Service when logging into a public account and Terms |
| 542 // of Service have been specified through policy. In all other cases, advance | 528 // of Service have been specified through policy. In all other cases, advance |
| 543 // to the Arc opt-in screen immediately. | 529 // to the Arc opt-in screen immediately. |
| 544 if (!user_manager::UserManager::Get()->IsLoggedInAsPublicAccount() || | 530 if (!user_manager::UserManager::Get()->IsLoggedInAsPublicAccount() || |
| 545 !ProfileManager::GetActiveUserProfile()->GetPrefs()->IsManagedPreference( | 531 !ProfileManager::GetActiveUserProfile()->GetPrefs()->IsManagedPreference( |
| 546 prefs::kTermsOfServiceURL)) { | 532 prefs::kTermsOfServiceURL)) { |
| 547 ShowArcTermsOfServiceScreen(); | 533 ShowArcTermsOfServiceScreen(); |
| 548 return; | 534 return; |
| 549 } | 535 } |
| 550 | 536 |
| 551 VLOG(1) << "Showing Terms of Service screen."; | 537 VLOG(1) << "Showing Terms of Service screen."; |
| 552 SetStatusAreaVisible(true); | 538 SetStatusAreaVisible(true); |
| 553 SetCurrentScreen(GetScreen(kTermsOfServiceScreenName)); | 539 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_TERMS_OF_SERVICE)); |
| 554 } | 540 } |
| 555 | 541 |
| 556 void WizardController::ShowArcTermsOfServiceScreen() { | 542 void WizardController::ShowArcTermsOfServiceScreen() { |
| 557 bool show_arc_terms = false; | 543 bool show_arc_terms = false; |
| 558 const Profile* profile = ProfileManager::GetActiveUserProfile(); | 544 const Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 559 | 545 |
| 560 const base::CommandLine* command_line = | 546 const base::CommandLine* command_line = |
| 561 base::CommandLine::ForCurrentProcess(); | 547 base::CommandLine::ForCurrentProcess(); |
| 562 if (!command_line->HasSwitch(chromeos::switches::kEnableArcOOBEOptIn)) { | 548 if (!command_line->HasSwitch(chromeos::switches::kEnableArcOOBEOptIn)) { |
| 563 VLOG(1) << "Skip Arc Terms of Service screen because Arc OOBE OptIn is " | 549 VLOG(1) << "Skip Arc Terms of Service screen because Arc OOBE OptIn is " |
| 564 << "disabled."; | 550 << "disabled."; |
| 565 } else if (!user_manager::UserManager::Get()->IsUserLoggedIn()) { | 551 } else if (!user_manager::UserManager::Get()->IsUserLoggedIn()) { |
| 566 VLOG(1) << "Skip Arc Terms of Service screen because user is not " | 552 VLOG(1) << "Skip Arc Terms of Service screen because user is not " |
| 567 << "logged in."; | 553 << "logged in."; |
| 568 } else if (!arc::ArcSessionManager::IsAllowedForProfile(profile)) { | 554 } else if (!arc::ArcSessionManager::IsAllowedForProfile(profile)) { |
| 569 VLOG(1) << "Skip Arc Terms of Service screen because Arc is not allowed."; | 555 VLOG(1) << "Skip Arc Terms of Service screen because Arc is not allowed."; |
| 570 } else if (profile->GetPrefs()->IsManagedPreference(prefs::kArcEnabled) && | 556 } else if (profile->GetPrefs()->IsManagedPreference(prefs::kArcEnabled) && |
| 571 !profile->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { | 557 !profile->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { |
| 572 VLOG(1) << "Skip Arc Terms of Service screen because Arc is disabled."; | 558 VLOG(1) << "Skip Arc Terms of Service screen because Arc is disabled."; |
| 573 } else { | 559 } else { |
| 574 show_arc_terms = true; | 560 show_arc_terms = true; |
| 575 } | 561 } |
| 576 | 562 |
| 577 if (show_arc_terms) { | 563 if (show_arc_terms) { |
| 578 VLOG(1) << "Showing Arc Terms of Service screen."; | 564 VLOG(1) << "Showing Arc Terms of Service screen."; |
| 579 SetStatusAreaVisible(true); | 565 SetStatusAreaVisible(true); |
| 580 SetCurrentScreen(GetScreen(kArcTermsOfServiceScreenName)); | 566 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE)); |
| 581 } else { | 567 } else { |
| 582 ShowUserImageScreen(); | 568 ShowUserImageScreen(); |
| 583 } | 569 } |
| 584 } | 570 } |
| 585 | 571 |
| 586 void WizardController::ShowWrongHWIDScreen() { | 572 void WizardController::ShowWrongHWIDScreen() { |
| 587 VLOG(1) << "Showing wrong HWID screen."; | 573 VLOG(1) << "Showing wrong HWID screen."; |
| 588 SetStatusAreaVisible(false); | 574 SetStatusAreaVisible(false); |
| 589 SetCurrentScreen(GetScreen(kWrongHWIDScreenName)); | 575 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_WRONG_HWID)); |
| 590 } | 576 } |
| 591 | 577 |
| 592 void WizardController::ShowAutoEnrollmentCheckScreen() { | 578 void WizardController::ShowAutoEnrollmentCheckScreen() { |
| 593 VLOG(1) << "Showing Auto-enrollment check screen."; | 579 VLOG(1) << "Showing Auto-enrollment check screen."; |
| 594 SetStatusAreaVisible(true); | 580 SetStatusAreaVisible(true); |
| 595 AutoEnrollmentCheckScreen* screen = AutoEnrollmentCheckScreen::Get(this); | 581 AutoEnrollmentCheckScreen* screen = AutoEnrollmentCheckScreen::Get(this); |
| 596 if (retry_auto_enrollment_check_) | 582 if (retry_auto_enrollment_check_) |
| 597 screen->ClearState(); | 583 screen->ClearState(); |
| 598 screen->set_auto_enrollment_controller(host_->GetAutoEnrollmentController()); | 584 screen->set_auto_enrollment_controller(host_->GetAutoEnrollmentController()); |
| 599 SetCurrentScreen(screen); | 585 SetCurrentScreen(screen); |
| 600 } | 586 } |
| 601 | 587 |
| 602 void WizardController::ShowSupervisedUserCreationScreen() { | 588 void WizardController::ShowSupervisedUserCreationScreen() { |
| 603 VLOG(1) << "Showing Locally managed user creation screen screen."; | 589 VLOG(1) << "Showing Locally managed user creation screen screen."; |
| 604 SetStatusAreaVisible(true); | 590 SetStatusAreaVisible(true); |
| 605 SetCurrentScreen(GetScreen(kSupervisedUserCreationScreenName)); | 591 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_CREATE_SUPERVISED_USER_FLOW)); |
| 606 } | 592 } |
| 607 | 593 |
| 608 void WizardController::ShowHIDDetectionScreen() { | 594 void WizardController::ShowHIDDetectionScreen() { |
| 609 VLOG(1) << "Showing HID discovery screen."; | 595 VLOG(1) << "Showing HID discovery screen."; |
| 610 // TODO(drcrash): Remove this after testing (http://crbug.com/647411). | 596 // TODO(drcrash): Remove this after testing (http://crbug.com/647411). |
| 611 SetShowMdOobe(false); // Disable the MD OOBE from there on. | 597 SetShowMdOobe(false); // Disable the MD OOBE from there on. |
| 612 SetStatusAreaVisible(true); | 598 SetStatusAreaVisible(true); |
| 613 SetCurrentScreen(GetScreen(kHIDDetectionScreenName)); | 599 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_OOBE_HID_DETECTION)); |
| 614 // In HID detection screen, puts the Bluetooth in discoverable mode and waits | 600 // In HID detection screen, puts the Bluetooth in discoverable mode and waits |
| 615 // for the incoming Bluetooth connection request. See the comments in | 601 // for the incoming Bluetooth connection request. See the comments in |
| 616 // WizardController::ShowNetworkScreen() for more details. | 602 // WizardController::ShowNetworkScreen() for more details. |
| 617 MaybeStartListeningForSharkConnection(); | 603 MaybeStartListeningForSharkConnection(); |
| 618 } | 604 } |
| 619 | 605 |
| 620 void WizardController::ShowControllerPairingScreen() { | 606 void WizardController::ShowControllerPairingScreen() { |
| 621 VLOG(1) << "Showing controller pairing screen."; | 607 VLOG(1) << "Showing controller pairing screen."; |
| 622 SetStatusAreaVisible(false); | 608 SetStatusAreaVisible(false); |
| 623 SetCurrentScreen(GetScreen(kControllerPairingScreenName)); | 609 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_OOBE_CONTROLLER_PAIRING)); |
| 624 } | 610 } |
| 625 | 611 |
| 626 void WizardController::ShowHostPairingScreen() { | 612 void WizardController::ShowHostPairingScreen() { |
| 627 VLOG(1) << "Showing host pairing screen."; | 613 VLOG(1) << "Showing host pairing screen."; |
| 628 SetStatusAreaVisible(false); | 614 SetStatusAreaVisible(false); |
| 629 SetCurrentScreen(GetScreen(kHostPairingScreenName)); | 615 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_OOBE_HOST_PAIRING)); |
| 630 } | 616 } |
| 631 | 617 |
| 632 void WizardController::ShowDeviceDisabledScreen() { | 618 void WizardController::ShowDeviceDisabledScreen() { |
| 633 VLOG(1) << "Showing device disabled screen."; | 619 VLOG(1) << "Showing device disabled screen."; |
| 634 SetStatusAreaVisible(true); | 620 SetStatusAreaVisible(true); |
| 635 SetCurrentScreen(GetScreen(kDeviceDisabledScreenName)); | 621 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_DEVICE_DISABLED)); |
| 636 } | 622 } |
| 637 | 623 |
| 638 void WizardController::SkipToLoginForTesting( | 624 void WizardController::SkipToLoginForTesting( |
| 639 const LoginScreenContext& context) { | 625 const LoginScreenContext& context) { |
| 640 VLOG(1) << "SkipToLoginForTesting."; | 626 VLOG(1) << "SkipToLoginForTesting."; |
| 641 StartupUtils::MarkEulaAccepted(); | 627 StartupUtils::MarkEulaAccepted(); |
| 642 PerformPostEulaActions(); | 628 PerformPostEulaActions(); |
| 643 OnDeviceDisabledChecked(false /* device_disabled */); | 629 OnDeviceDisabledChecked(false /* device_disabled */); |
| 644 } | 630 } |
| 645 | 631 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 887 } | 873 } |
| 888 | 874 |
| 889 void WizardController::InitiateOOBEUpdate() { | 875 void WizardController::InitiateOOBEUpdate() { |
| 890 if (IsRemoraRequisition()) { | 876 if (IsRemoraRequisition()) { |
| 891 VLOG(1) << "Skip OOBE Update for remora."; | 877 VLOG(1) << "Skip OOBE Update for remora."; |
| 892 OnUpdateCompleted(); | 878 OnUpdateCompleted(); |
| 893 return; | 879 return; |
| 894 } | 880 } |
| 895 | 881 |
| 896 VLOG(1) << "InitiateOOBEUpdate"; | 882 VLOG(1) << "InitiateOOBEUpdate"; |
| 897 SetCurrentScreenSmooth(GetScreen(kUpdateScreenName), true); | 883 SetCurrentScreenSmooth(GetScreen(OobeScreen::SCREEN_OOBE_UPDATE), true); |
| 898 UpdateScreen::Get(this)->StartNetworkCheck(); | 884 UpdateScreen::Get(this)->StartNetworkCheck(); |
| 899 } | 885 } |
| 900 | 886 |
| 901 void WizardController::StartTimezoneResolve() { | 887 void WizardController::StartTimezoneResolve() { |
| 902 geolocation_provider_.reset(new SimpleGeolocationProvider( | 888 geolocation_provider_.reset(new SimpleGeolocationProvider( |
| 903 g_browser_process->system_request_context(), | 889 g_browser_process->system_request_context(), |
| 904 SimpleGeolocationProvider::DefaultGeolocationProviderURL())); | 890 SimpleGeolocationProvider::DefaultGeolocationProviderURL())); |
| 905 geolocation_provider_->RequestGeolocation( | 891 geolocation_provider_->RequestGeolocation( |
| 906 base::TimeDelta::FromSeconds(kResolveTimeZoneTimeoutSeconds), | 892 base::TimeDelta::FromSeconds(kResolveTimeZoneTimeoutSeconds), |
| 907 false /* send_wifi_geolocation_data */, | 893 false /* send_wifi_geolocation_data */, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 950 SetCurrentScreenSmooth(new_current, false); | 936 SetCurrentScreenSmooth(new_current, false); |
| 951 } | 937 } |
| 952 | 938 |
| 953 void WizardController::ShowCurrentScreen() { | 939 void WizardController::ShowCurrentScreen() { |
| 954 // ShowCurrentScreen may get called by smooth_show_timer_ even after | 940 // ShowCurrentScreen may get called by smooth_show_timer_ even after |
| 955 // flow has been switched to sign in screen (ExistingUserController). | 941 // flow has been switched to sign in screen (ExistingUserController). |
| 956 if (!oobe_ui_) | 942 if (!oobe_ui_) |
| 957 return; | 943 return; |
| 958 | 944 |
| 959 // First remember how far have we reached so that we can resume if needed. | 945 // First remember how far have we reached so that we can resume if needed. |
| 960 if (is_out_of_box_ && IsResumableScreen(current_screen_->screen_id())) | 946 if (is_out_of_box_ && IsResumableScreen(current_screen_->screen_id())) { |
| 961 StartupUtils::SaveOobePendingScreen(current_screen_->screen_id()); | 947 StartupUtils::SaveOobePendingScreen( |
| 948 GetOobeScreenName(current_screen_->screen_id())); | |
| 949 } | |
| 962 | 950 |
| 963 smooth_show_timer_.Stop(); | 951 smooth_show_timer_.Stop(); |
| 964 | 952 |
| 965 for (auto& observer : observer_list_) | 953 for (auto& observer : observer_list_) |
| 966 observer.OnScreenChanged(current_screen_); | 954 observer.OnScreenChanged(current_screen_); |
| 967 | 955 |
| 968 current_screen_->Show(); | 956 current_screen_->Show(); |
| 969 } | 957 } |
| 970 | 958 |
| 971 void WizardController::SetCurrentScreenSmooth(BaseScreen* new_current, | 959 void WizardController::SetCurrentScreenSmooth(BaseScreen* new_current, |
| 972 bool use_smoothing) { | 960 bool use_smoothing) { |
| 973 if (current_screen_ == new_current || new_current == nullptr || | 961 if (current_screen_ == new_current || new_current == nullptr || |
| 974 oobe_ui_ == nullptr) { | 962 oobe_ui_ == nullptr) { |
| 975 return; | 963 return; |
| 976 } | 964 } |
| 977 | 965 |
| 978 smooth_show_timer_.Stop(); | 966 smooth_show_timer_.Stop(); |
| 979 | 967 |
| 980 if (current_screen_) | 968 if (current_screen_) |
| 981 current_screen_->Hide(); | 969 current_screen_->Hide(); |
| 982 | 970 |
| 983 std::string screen_id = new_current->screen_id(); | 971 OobeScreen screen = new_current->screen_id(); |
| 984 if (IsOOBEStepToTrack(screen_id)) | 972 if (IsOOBEStepToTrack(screen)) |
| 985 screen_show_times_[screen_id] = base::Time::Now(); | 973 screen_show_times_[GetOobeScreenName(screen)] = base::Time::Now(); |
| 986 | 974 |
| 987 previous_screen_ = current_screen_; | 975 previous_screen_ = current_screen_; |
| 988 current_screen_ = new_current; | 976 current_screen_ = new_current; |
| 989 | 977 |
| 990 if (use_smoothing) { | 978 if (use_smoothing) { |
| 991 smooth_show_timer_.Start( | 979 smooth_show_timer_.Start( |
| 992 FROM_HERE, | 980 FROM_HERE, |
| 993 base::TimeDelta::FromMilliseconds(kShowDelayMs), | 981 base::TimeDelta::FromMilliseconds(kShowDelayMs), |
| 994 this, | 982 this, |
| 995 &WizardController::ShowCurrentScreen); | 983 &WizardController::ShowCurrentScreen); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1010 if (!oobe_ui_) | 998 if (!oobe_ui_) |
| 1011 return; | 999 return; |
| 1012 | 1000 |
| 1013 if (screen_needed) { | 1001 if (screen_needed) { |
| 1014 ShowHIDDetectionScreen(); | 1002 ShowHIDDetectionScreen(); |
| 1015 } else { | 1003 } else { |
| 1016 ShowNetworkScreen(); | 1004 ShowNetworkScreen(); |
| 1017 } | 1005 } |
| 1018 } | 1006 } |
| 1019 | 1007 |
| 1020 void WizardController::AdvanceToScreen(const std::string& screen_name) { | 1008 void WizardController::AdvanceToScreen(OobeScreen screen) { |
| 1021 if (screen_name == kNetworkScreenName) { | 1009 if (screen == OobeScreen::SCREEN_OOBE_NETWORK) { |
| 1022 ShowNetworkScreen(); | 1010 ShowNetworkScreen(); |
| 1023 } else if (screen_name == kLoginScreenName) { | 1011 } else if (screen == OobeScreen::SCREEN_SPECIAL_LOGIN) { |
| 1024 ShowLoginScreen(LoginScreenContext()); | 1012 ShowLoginScreen(LoginScreenContext()); |
| 1025 } else if (screen_name == kUpdateScreenName) { | 1013 } else if (screen == OobeScreen::SCREEN_OOBE_UPDATE) { |
| 1026 InitiateOOBEUpdate(); | 1014 InitiateOOBEUpdate(); |
| 1027 } else if (screen_name == kUserImageScreenName) { | 1015 } else if (screen == OobeScreen::SCREEN_USER_IMAGE_PICKER) { |
| 1028 ShowUserImageScreen(); | 1016 ShowUserImageScreen(); |
| 1029 } else if (screen_name == kEulaScreenName) { | 1017 } else if (screen == OobeScreen::SCREEN_OOBE_EULA) { |
| 1030 ShowEulaScreen(); | 1018 ShowEulaScreen(); |
| 1031 } else if (screen_name == kResetScreenName) { | 1019 } else if (screen == OobeScreen::SCREEN_OOBE_RESET) { |
| 1032 ShowResetScreen(); | 1020 ShowResetScreen(); |
| 1033 } else if (screen_name == kKioskEnableScreenName) { | 1021 } else if (screen == OobeScreen::SCREEN_KIOSK_ENABLE) { |
| 1034 ShowKioskEnableScreen(); | 1022 ShowKioskEnableScreen(); |
| 1035 } else if (screen_name == kKioskAutolaunchScreenName) { | 1023 } else if (screen == OobeScreen::SCREEN_KIOSK_AUTOLAUNCH) { |
| 1036 ShowKioskAutolaunchScreen(); | 1024 ShowKioskAutolaunchScreen(); |
| 1037 } else if (screen_name == kEnableDebuggingScreenName) { | 1025 } else if (screen == OobeScreen::SCREEN_OOBE_ENABLE_DEBUGGING) { |
| 1038 ShowEnableDebuggingScreen(); | 1026 ShowEnableDebuggingScreen(); |
| 1039 } else if (screen_name == kEnrollmentScreenName) { | 1027 } else if (screen == OobeScreen::SCREEN_OOBE_ENROLLMENT) { |
| 1040 ShowEnrollmentScreen(); | 1028 ShowEnrollmentScreen(); |
| 1041 } else if (screen_name == kTermsOfServiceScreenName) { | 1029 } else if (screen == OobeScreen::SCREEN_TERMS_OF_SERVICE) { |
| 1042 ShowTermsOfServiceScreen(); | 1030 ShowTermsOfServiceScreen(); |
| 1043 } else if (screen_name == kArcTermsOfServiceScreenName) { | 1031 } else if (screen == OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE) { |
| 1044 ShowArcTermsOfServiceScreen(); | 1032 ShowArcTermsOfServiceScreen(); |
| 1045 } else if (screen_name == kWrongHWIDScreenName) { | 1033 } else if (screen == OobeScreen::SCREEN_WRONG_HWID) { |
| 1046 ShowWrongHWIDScreen(); | 1034 ShowWrongHWIDScreen(); |
| 1047 } else if (screen_name == kAutoEnrollmentCheckScreenName) { | 1035 } else if (screen == OobeScreen::SCREEN_AUTO_ENROLLMENT_CHECK) { |
| 1048 ShowAutoEnrollmentCheckScreen(); | 1036 ShowAutoEnrollmentCheckScreen(); |
| 1049 } else if (screen_name == kSupervisedUserCreationScreenName) { | 1037 } else if (screen == OobeScreen::SCREEN_CREATE_SUPERVISED_USER_FLOW) { |
| 1050 ShowSupervisedUserCreationScreen(); | 1038 ShowSupervisedUserCreationScreen(); |
| 1051 } else if (screen_name == kAppLaunchSplashScreenName) { | 1039 } else if (screen == OobeScreen::SCREEN_APP_LAUNCH_SPLASH) { |
| 1052 AutoLaunchKioskApp(); | 1040 AutoLaunchKioskApp(); |
| 1053 } else if (screen_name == kHIDDetectionScreenName) { | 1041 } else if (screen == OobeScreen::SCREEN_OOBE_HID_DETECTION) { |
| 1054 ShowHIDDetectionScreen(); | 1042 ShowHIDDetectionScreen(); |
| 1055 } else if (screen_name == kControllerPairingScreenName) { | 1043 } else if (screen == OobeScreen::SCREEN_OOBE_CONTROLLER_PAIRING) { |
| 1056 ShowControllerPairingScreen(); | 1044 ShowControllerPairingScreen(); |
| 1057 } else if (screen_name == kHostPairingScreenName) { | 1045 } else if (screen == OobeScreen::SCREEN_OOBE_HOST_PAIRING) { |
| 1058 ShowHostPairingScreen(); | 1046 ShowHostPairingScreen(); |
| 1059 } else if (screen_name == kDeviceDisabledScreenName) { | 1047 } else if (screen == OobeScreen::SCREEN_DEVICE_DISABLED) { |
| 1060 ShowDeviceDisabledScreen(); | 1048 ShowDeviceDisabledScreen(); |
| 1061 } else if (screen_name != kTestNoScreenName) { | 1049 } else if (screen != OobeScreen::SCREEN_TEST_NO_WINDOW) { |
| 1062 if (is_out_of_box_) { | 1050 if (is_out_of_box_) { |
| 1063 time_oobe_started_ = base::Time::Now(); | 1051 time_oobe_started_ = base::Time::Now(); |
| 1064 if (IsRemoraPairingOobe() || IsControllerDetected()) { | 1052 if (IsRemoraPairingOobe() || IsControllerDetected()) { |
| 1065 ShowHostPairingScreen(); | 1053 ShowHostPairingScreen(); |
| 1066 } else if (CanShowHIDDetectionScreen()) { | 1054 } else if (CanShowHIDDetectionScreen()) { |
| 1067 hid_screen_ = GetScreen(kHIDDetectionScreenName); | 1055 hid_screen_ = GetScreen(OobeScreen::SCREEN_OOBE_HID_DETECTION); |
| 1068 base::Callback<void(bool)> on_check = base::Bind( | 1056 base::Callback<void(bool)> on_check = base::Bind( |
| 1069 &WizardController::OnHIDScreenNecessityCheck, | 1057 &WizardController::OnHIDScreenNecessityCheck, |
| 1070 weak_factory_.GetWeakPtr()); | 1058 weak_factory_.GetWeakPtr()); |
| 1071 oobe_ui_->GetHIDDetectionView()->CheckIsScreenRequired(on_check); | 1059 oobe_ui_->GetHIDDetectionView()->CheckIsScreenRequired(on_check); |
| 1072 } else { | 1060 } else { |
| 1073 ShowNetworkScreen(); | 1061 ShowNetworkScreen(); |
| 1074 } | 1062 } |
| 1075 } else { | 1063 } else { |
| 1076 ShowLoginScreen(LoginScreenContext()); | 1064 ShowLoginScreen(LoginScreenContext()); |
| 1077 } | 1065 } |
| 1078 } | 1066 } |
| 1079 } | 1067 } |
| 1080 | 1068 |
| 1081 /////////////////////////////////////////////////////////////////////////////// | 1069 /////////////////////////////////////////////////////////////////////////////// |
| 1082 // WizardController, BaseScreenDelegate overrides: | 1070 // WizardController, BaseScreenDelegate overrides: |
| 1083 void WizardController::OnExit(BaseScreen& /* screen */, | 1071 void WizardController::OnExit(BaseScreen& /* screen */, |
| 1084 ExitCodes exit_code, | 1072 ExitCodes exit_code, |
| 1085 const ::login::ScreenContext* /* context */) { | 1073 const ::login::ScreenContext* /* context */) { |
| 1086 VLOG(1) << "Wizard screen exit code: " << exit_code; | 1074 VLOG(1) << "Wizard screen exit code: " << exit_code; |
| 1087 std::string previous_screen_id = current_screen_->screen_id(); | 1075 OobeScreen previous_screen = current_screen_->screen_id(); |
| 1088 if (IsOOBEStepToTrack(previous_screen_id)) { | 1076 if (IsOOBEStepToTrack(previous_screen)) { |
| 1089 RecordUMAHistogramForOOBEStepCompletionTime( | 1077 RecordUMAHistogramForOOBEStepCompletionTime( |
| 1090 previous_screen_id, | 1078 previous_screen, |
| 1091 base::Time::Now() - screen_show_times_[previous_screen_id]); | 1079 base::Time::Now() - |
| 1080 screen_show_times_[GetOobeScreenName(previous_screen)]); | |
| 1092 } | 1081 } |
| 1093 switch (exit_code) { | 1082 switch (exit_code) { |
| 1094 case HID_DETECTION_COMPLETED: | 1083 case HID_DETECTION_COMPLETED: |
| 1095 OnHIDDetectionCompleted(); | 1084 OnHIDDetectionCompleted(); |
| 1096 break; | 1085 break; |
| 1097 case NETWORK_CONNECTED: | 1086 case NETWORK_CONNECTED: |
| 1098 OnNetworkConnected(); | 1087 OnNetworkConnected(); |
| 1099 break; | 1088 break; |
| 1100 case CONNECTION_FAILED: | 1089 case CONNECTION_FAILED: |
| 1101 OnConnectionFailed(); | 1090 OnConnectionFailed(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1162 case CONTROLLER_PAIRING_FINISHED: | 1151 case CONTROLLER_PAIRING_FINISHED: |
| 1163 OnControllerPairingFinished(); | 1152 OnControllerPairingFinished(); |
| 1164 break; | 1153 break; |
| 1165 default: | 1154 default: |
| 1166 NOTREACHED(); | 1155 NOTREACHED(); |
| 1167 } | 1156 } |
| 1168 } | 1157 } |
| 1169 | 1158 |
| 1170 void WizardController::ShowErrorScreen() { | 1159 void WizardController::ShowErrorScreen() { |
| 1171 VLOG(1) << "Showing error screen."; | 1160 VLOG(1) << "Showing error screen."; |
| 1172 SetCurrentScreen(GetScreen(kErrorScreenName)); | 1161 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_ERROR_MESSAGE)); |
| 1173 } | 1162 } |
| 1174 | 1163 |
| 1175 void WizardController::HideErrorScreen(BaseScreen* parent_screen) { | 1164 void WizardController::HideErrorScreen(BaseScreen* parent_screen) { |
| 1176 DCHECK(parent_screen); | 1165 DCHECK(parent_screen); |
| 1177 VLOG(1) << "Hiding error screen."; | 1166 VLOG(1) << "Hiding error screen."; |
| 1178 SetCurrentScreen(parent_screen); | 1167 SetCurrentScreen(parent_screen); |
| 1179 } | 1168 } |
| 1180 | 1169 |
| 1181 void WizardController::SetUsageStatisticsReporting(bool val) { | 1170 void WizardController::SetUsageStatisticsReporting(bool val) { |
| 1182 usage_statistics_reporting_ = val; | 1171 usage_statistics_reporting_ = val; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1247 network_screen->CreateAndConnectNetworkFromOnc( | 1236 network_screen->CreateAndConnectNetworkFromOnc( |
| 1248 onc_spec, base::Bind(&WizardController::OnSetHostNetworkSuccessful, | 1237 onc_spec, base::Bind(&WizardController::OnSetHostNetworkSuccessful, |
| 1249 weak_factory_.GetWeakPtr()), | 1238 weak_factory_.GetWeakPtr()), |
| 1250 base::Bind(&WizardController::OnSetHostNetworkFailed, | 1239 base::Bind(&WizardController::OnSetHostNetworkFailed, |
| 1251 weak_factory_.GetWeakPtr())); | 1240 weak_factory_.GetWeakPtr())); |
| 1252 } | 1241 } |
| 1253 } | 1242 } |
| 1254 | 1243 |
| 1255 void WizardController::OnEnableDebuggingScreenRequested() { | 1244 void WizardController::OnEnableDebuggingScreenRequested() { |
| 1256 if (!login_screen_started()) | 1245 if (!login_screen_started()) |
| 1257 AdvanceToScreen(WizardController::kEnableDebuggingScreenName); | 1246 AdvanceToScreen(OobeScreen::SCREEN_OOBE_ENABLE_DEBUGGING); |
| 1258 } | 1247 } |
| 1259 | 1248 |
| 1260 void WizardController::OnAccessibilityStatusChanged( | 1249 void WizardController::OnAccessibilityStatusChanged( |
| 1261 const AccessibilityStatusEventDetails& details) { | 1250 const AccessibilityStatusEventDetails& details) { |
| 1262 enum AccessibilityNotificationType type = details.notification_type; | 1251 enum AccessibilityNotificationType type = details.notification_type; |
| 1263 if (type == ACCESSIBILITY_MANAGER_SHUTDOWN) { | 1252 if (type == ACCESSIBILITY_MANAGER_SHUTDOWN) { |
| 1264 accessibility_subscription_.reset(); | 1253 accessibility_subscription_.reset(); |
| 1265 return; | 1254 return; |
| 1266 } else if (type != ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK || !details.enabled) { | 1255 } else if (type != ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK || !details.enabled) { |
| 1267 return; | 1256 return; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1318 kShowDelayMs = 0; | 1307 kShowDelayMs = 0; |
| 1319 zero_delay_enabled_ = true; | 1308 zero_delay_enabled_ = true; |
| 1320 } | 1309 } |
| 1321 | 1310 |
| 1322 // static | 1311 // static |
| 1323 bool WizardController::IsZeroDelayEnabled() { | 1312 bool WizardController::IsZeroDelayEnabled() { |
| 1324 return zero_delay_enabled_; | 1313 return zero_delay_enabled_; |
| 1325 } | 1314 } |
| 1326 | 1315 |
| 1327 // static | 1316 // static |
| 1328 bool WizardController::IsOOBEStepToTrack(const std::string& screen_id) { | 1317 bool WizardController::IsOOBEStepToTrack(OobeScreen screen) { |
| 1329 return (screen_id == kHIDDetectionScreenName || | 1318 return (screen == OobeScreen::SCREEN_OOBE_HID_DETECTION || |
| 1330 screen_id == kNetworkScreenName || | 1319 screen == OobeScreen::SCREEN_OOBE_NETWORK || |
| 1331 screen_id == kUpdateScreenName || | 1320 screen == OobeScreen::SCREEN_OOBE_UPDATE || |
| 1332 screen_id == kUserImageScreenName || | 1321 screen == OobeScreen::SCREEN_USER_IMAGE_PICKER || |
| 1333 screen_id == kEulaScreenName || | 1322 screen == OobeScreen::SCREEN_OOBE_EULA || |
| 1334 screen_id == kLoginScreenName || | 1323 screen == OobeScreen::SCREEN_SPECIAL_LOGIN || |
| 1335 screen_id == kWrongHWIDScreenName); | 1324 screen == OobeScreen::SCREEN_WRONG_HWID); |
| 1336 } | 1325 } |
| 1337 | 1326 |
| 1338 // static | 1327 // static |
| 1339 void WizardController::SkipPostLoginScreensForTesting() { | 1328 void WizardController::SkipPostLoginScreensForTesting() { |
| 1340 skip_post_login_screens_ = true; | 1329 skip_post_login_screens_ = true; |
| 1341 } | 1330 } |
| 1342 | 1331 |
| 1343 void WizardController::OnLocalStateInitialized(bool /* succeeded */) { | 1332 void WizardController::OnLocalStateInitialized(bool /* succeeded */) { |
| 1344 if (GetLocalState()->GetInitializationStatus() != | 1333 if (GetLocalState()->GetInitializationStatus() != |
| 1345 PrefService::INITIALIZATION_STATUS_ERROR) { | 1334 PrefService::INITIALIZATION_STATUS_ERROR) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1500 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; | 1489 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; |
| 1501 } | 1490 } |
| 1502 | 1491 |
| 1503 EnrollmentScreen* screen = EnrollmentScreen::Get(this); | 1492 EnrollmentScreen* screen = EnrollmentScreen::Get(this); |
| 1504 screen->SetParameters(effective_config, shark_controller_.get()); | 1493 screen->SetParameters(effective_config, shark_controller_.get()); |
| 1505 SetStatusAreaVisible(true); | 1494 SetStatusAreaVisible(true); |
| 1506 SetCurrentScreen(screen); | 1495 SetCurrentScreen(screen); |
| 1507 } | 1496 } |
| 1508 | 1497 |
| 1509 } // namespace chromeos | 1498 } // namespace chromeos |
| OLD | NEW |