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

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

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

Powered by Google App Engine
This is Rietveld 408576698