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