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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 // static | 245 // static |
246 bool WizardController::zero_delay_enabled_ = false; | 246 bool WizardController::zero_delay_enabled_ = false; |
247 | 247 |
248 /////////////////////////////////////////////////////////////////////////////// | 248 /////////////////////////////////////////////////////////////////////////////// |
249 // WizardController, public: | 249 // WizardController, public: |
250 | 250 |
251 PrefService* WizardController::local_state_for_testing_ = nullptr; | 251 PrefService* WizardController::local_state_for_testing_ = nullptr; |
252 | 252 |
253 WizardController::WizardController(LoginDisplayHost* host, OobeUI* oobe_ui) | 253 WizardController::WizardController(LoginDisplayHost* host, OobeUI* oobe_ui) |
254 : host_(host), oobe_ui_(oobe_ui), weak_factory_(this) { | 254 : screen_manager_(this), |
| 255 host_(host), |
| 256 oobe_ui_(oobe_ui), |
| 257 weak_factory_(this) { |
255 DCHECK(default_controller_ == nullptr); | 258 DCHECK(default_controller_ == nullptr); |
256 default_controller_ = this; | 259 default_controller_ = this; |
257 if (!ash_util::IsRunningInMash()) { | 260 if (!ash_util::IsRunningInMash()) { |
258 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); | 261 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); |
259 CHECK(accessibility_manager); | 262 CHECK(accessibility_manager); |
260 accessibility_subscription_ = accessibility_manager->RegisterCallback( | 263 accessibility_subscription_ = accessibility_manager->RegisterCallback( |
261 base::Bind(&WizardController::OnAccessibilityStatusChanged, | 264 base::Bind(&WizardController::OnAccessibilityStatusChanged, |
262 base::Unretained(this))); | 265 base::Unretained(this))); |
263 } else { | 266 } else { |
264 NOTIMPLEMENTED(); | 267 NOTIMPLEMENTED(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 ShowWrongHWIDScreen(); | 354 ShowWrongHWIDScreen(); |
352 } | 355 } |
353 | 356 |
354 ErrorScreen* WizardController::GetErrorScreen() { | 357 ErrorScreen* WizardController::GetErrorScreen() { |
355 return oobe_ui_->GetErrorScreen(); | 358 return oobe_ui_->GetErrorScreen(); |
356 } | 359 } |
357 | 360 |
358 BaseScreen* WizardController::GetScreen(OobeScreen screen) { | 361 BaseScreen* WizardController::GetScreen(OobeScreen screen) { |
359 if (screen == OobeScreen::SCREEN_ERROR_MESSAGE) | 362 if (screen == OobeScreen::SCREEN_ERROR_MESSAGE) |
360 return GetErrorScreen(); | 363 return GetErrorScreen(); |
361 return ScreenManager::GetScreen(screen); | 364 return screen_manager_.GetScreen(screen); |
362 } | 365 } |
363 | 366 |
364 BaseScreen* WizardController::CreateScreen(OobeScreen screen) { | 367 BaseScreen* WizardController::CreateScreen(OobeScreen screen) { |
365 if (screen == OobeScreen::SCREEN_OOBE_NETWORK) { | 368 if (screen == OobeScreen::SCREEN_OOBE_NETWORK) { |
366 return new NetworkScreen(this, this, oobe_ui_->GetNetworkView()); | 369 return new NetworkScreen(this, this, oobe_ui_->GetNetworkView()); |
367 } else if (screen == OobeScreen::SCREEN_OOBE_UPDATE) { | 370 } else if (screen == OobeScreen::SCREEN_OOBE_UPDATE) { |
368 return new UpdateScreen(this, oobe_ui_->GetUpdateView(), | 371 return new UpdateScreen(this, oobe_ui_->GetUpdateView(), |
369 remora_controller_.get()); | 372 remora_controller_.get()); |
370 } else if (screen == OobeScreen::SCREEN_USER_IMAGE_PICKER) { | 373 } else if (screen == OobeScreen::SCREEN_USER_IMAGE_PICKER) { |
371 return new UserImageScreen(this, oobe_ui_->GetUserImageView()); | 374 return new UserImageScreen(this, oobe_ui_->GetUserImageView()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 oobe_ui_->GetDeviceDisabledScreenView()); | 426 oobe_ui_->GetDeviceDisabledScreenView()); |
424 } | 427 } |
425 | 428 |
426 return nullptr; | 429 return nullptr; |
427 } | 430 } |
428 | 431 |
429 void WizardController::ShowNetworkScreen() { | 432 void WizardController::ShowNetworkScreen() { |
430 VLOG(1) << "Showing network screen."; | 433 VLOG(1) << "Showing network screen."; |
431 // Hide the status area initially; it only appears after OOBE first animates | 434 // Hide the status area initially; it only appears after OOBE first animates |
432 // in. Keep it visible if the user goes back to the existing network screen. | 435 // in. Keep it visible if the user goes back to the existing network screen. |
433 SetStatusAreaVisible(HasScreen(OobeScreen::SCREEN_OOBE_NETWORK)); | 436 SetStatusAreaVisible( |
| 437 screen_manager_.HasScreen(OobeScreen::SCREEN_OOBE_NETWORK)); |
434 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_OOBE_NETWORK)); | 438 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_OOBE_NETWORK)); |
435 | 439 |
436 // There are two possible screens where we listen to the incoming Bluetooth | 440 // There are two possible screens where we listen to the incoming Bluetooth |
437 // connection request: the first one is the HID detection screen, which will | 441 // connection request: the first one is the HID detection screen, which will |
438 // show up when there is no sufficient input devices. In this case, we just | 442 // show up when there is no sufficient input devices. In this case, we just |
439 // keep the logic as it is today: always put the Bluetooth is discoverable | 443 // keep the logic as it is today: always put the Bluetooth is discoverable |
440 // mode. The other place is the Network screen (here), which will show up when | 444 // mode. The other place is the Network screen (here), which will show up when |
441 // there are input devices detected. In this case, we disable the Bluetooth by | 445 // there are input devices detected. In this case, we disable the Bluetooth by |
442 // default until the user explicitly enable it by pressing a key combo (Ctrl+ | 446 // default until the user explicitly enable it by pressing a key combo (Ctrl+ |
443 // Alt+Shift+S). | 447 // Alt+Shift+S). |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 579 |
576 void WizardController::ShowWrongHWIDScreen() { | 580 void WizardController::ShowWrongHWIDScreen() { |
577 VLOG(1) << "Showing wrong HWID screen."; | 581 VLOG(1) << "Showing wrong HWID screen."; |
578 SetStatusAreaVisible(false); | 582 SetStatusAreaVisible(false); |
579 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_WRONG_HWID)); | 583 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_WRONG_HWID)); |
580 } | 584 } |
581 | 585 |
582 void WizardController::ShowAutoEnrollmentCheckScreen() { | 586 void WizardController::ShowAutoEnrollmentCheckScreen() { |
583 VLOG(1) << "Showing Auto-enrollment check screen."; | 587 VLOG(1) << "Showing Auto-enrollment check screen."; |
584 SetStatusAreaVisible(true); | 588 SetStatusAreaVisible(true); |
585 AutoEnrollmentCheckScreen* screen = AutoEnrollmentCheckScreen::Get(this); | 589 AutoEnrollmentCheckScreen* screen = |
| 590 AutoEnrollmentCheckScreen::Get(screen_manager()); |
586 if (retry_auto_enrollment_check_) | 591 if (retry_auto_enrollment_check_) |
587 screen->ClearState(); | 592 screen->ClearState(); |
588 screen->set_auto_enrollment_controller(host_->GetAutoEnrollmentController()); | 593 screen->set_auto_enrollment_controller(host_->GetAutoEnrollmentController()); |
589 SetCurrentScreen(screen); | 594 SetCurrentScreen(screen); |
590 } | 595 } |
591 | 596 |
592 void WizardController::ShowSupervisedUserCreationScreen() { | 597 void WizardController::ShowSupervisedUserCreationScreen() { |
593 VLOG(1) << "Showing Locally managed user creation screen screen."; | 598 VLOG(1) << "Showing Locally managed user creation screen screen."; |
594 SetStatusAreaVisible(true); | 599 SetStatusAreaVisible(true); |
595 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_CREATE_SUPERVISED_USER_FLOW)); | 600 SetCurrentScreen(GetScreen(OobeScreen::SCREEN_CREATE_SUPERVISED_USER_FLOW)); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 true, base::Bind(&WizardController::StartOOBEUpdate, | 891 true, base::Bind(&WizardController::StartOOBEUpdate, |
887 weak_factory_.GetWeakPtr())); | 892 weak_factory_.GetWeakPtr())); |
888 } else { | 893 } else { |
889 StartOOBEUpdate(); | 894 StartOOBEUpdate(); |
890 } | 895 } |
891 } | 896 } |
892 | 897 |
893 void WizardController::StartOOBEUpdate() { | 898 void WizardController::StartOOBEUpdate() { |
894 VLOG(1) << "StartOOBEUpdate"; | 899 VLOG(1) << "StartOOBEUpdate"; |
895 SetCurrentScreenSmooth(GetScreen(OobeScreen::SCREEN_OOBE_UPDATE), true); | 900 SetCurrentScreenSmooth(GetScreen(OobeScreen::SCREEN_OOBE_UPDATE), true); |
896 UpdateScreen::Get(this)->StartNetworkCheck(); | 901 UpdateScreen::Get(screen_manager())->StartNetworkCheck(); |
897 } | 902 } |
898 | 903 |
899 void WizardController::StartTimezoneResolve() { | 904 void WizardController::StartTimezoneResolve() { |
900 geolocation_provider_.reset(new SimpleGeolocationProvider( | 905 geolocation_provider_.reset(new SimpleGeolocationProvider( |
901 g_browser_process->system_request_context(), | 906 g_browser_process->system_request_context(), |
902 SimpleGeolocationProvider::DefaultGeolocationProviderURL())); | 907 SimpleGeolocationProvider::DefaultGeolocationProviderURL())); |
903 geolocation_provider_->RequestGeolocation( | 908 geolocation_provider_->RequestGeolocation( |
904 base::TimeDelta::FromSeconds(kResolveTimeZoneTimeoutSeconds), | 909 base::TimeDelta::FromSeconds(kResolveTimeZoneTimeoutSeconds), |
905 false /* send_wifi_geolocation_data */, | 910 false /* send_wifi_geolocation_data */, |
906 false /* send_cellular_geolocation_data */, | 911 false /* send_cellular_geolocation_data */, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 usage_statistics_reporting_ = val; | 1193 usage_statistics_reporting_ = val; |
1189 } | 1194 } |
1190 | 1195 |
1191 bool WizardController::GetUsageStatisticsReporting() const { | 1196 bool WizardController::GetUsageStatisticsReporting() const { |
1192 return usage_statistics_reporting_; | 1197 return usage_statistics_reporting_; |
1193 } | 1198 } |
1194 | 1199 |
1195 void WizardController::SetHostNetwork() { | 1200 void WizardController::SetHostNetwork() { |
1196 if (!shark_controller_) | 1201 if (!shark_controller_) |
1197 return; | 1202 return; |
1198 NetworkScreen* network_screen = NetworkScreen::Get(this); | 1203 NetworkScreen* network_screen = NetworkScreen::Get(screen_manager()); |
1199 std::string onc_spec; | 1204 std::string onc_spec; |
1200 network_screen->GetConnectedWifiNetwork(&onc_spec); | 1205 network_screen->GetConnectedWifiNetwork(&onc_spec); |
1201 if (!onc_spec.empty()) | 1206 if (!onc_spec.empty()) |
1202 shark_controller_->SetHostNetwork(onc_spec); | 1207 shark_controller_->SetHostNetwork(onc_spec); |
1203 } | 1208 } |
1204 | 1209 |
1205 void WizardController::SetHostConfiguration() { | 1210 void WizardController::SetHostConfiguration() { |
1206 if (!shark_controller_) | 1211 if (!shark_controller_) |
1207 return; | 1212 return; |
1208 NetworkScreen* network_screen = NetworkScreen::Get(this); | 1213 NetworkScreen* network_screen = NetworkScreen::Get(screen_manager()); |
1209 shark_controller_->SetHostConfiguration( | 1214 shark_controller_->SetHostConfiguration( |
1210 true, // Eula must be accepted before we get this far. | 1215 true, // Eula must be accepted before we get this far. |
1211 network_screen->GetApplicationLocale(), network_screen->GetTimezone(), | 1216 network_screen->GetApplicationLocale(), network_screen->GetTimezone(), |
1212 GetUsageStatisticsReporting(), network_screen->GetInputMethod()); | 1217 GetUsageStatisticsReporting(), network_screen->GetInputMethod()); |
1213 } | 1218 } |
1214 | 1219 |
1215 void WizardController::ConfigureHostRequested( | 1220 void WizardController::ConfigureHostRequested( |
1216 bool accepted_eula, | 1221 bool accepted_eula, |
1217 const std::string& lang, | 1222 const std::string& lang, |
1218 const std::string& timezone, | 1223 const std::string& timezone, |
1219 bool send_reports, | 1224 bool send_reports, |
1220 const std::string& keyboard_layout) { | 1225 const std::string& keyboard_layout) { |
1221 VLOG(1) << "ConfigureHost locale=" << lang << ", timezone=" << timezone | 1226 VLOG(1) << "ConfigureHost locale=" << lang << ", timezone=" << timezone |
1222 << ", keyboard_layout=" << keyboard_layout; | 1227 << ", keyboard_layout=" << keyboard_layout; |
1223 if (accepted_eula) // Always true. | 1228 if (accepted_eula) // Always true. |
1224 StartupUtils::MarkEulaAccepted(); | 1229 StartupUtils::MarkEulaAccepted(); |
1225 SetUsageStatisticsReporting(send_reports); | 1230 SetUsageStatisticsReporting(send_reports); |
1226 | 1231 |
1227 NetworkScreen* network_screen = NetworkScreen::Get(this); | 1232 NetworkScreen* network_screen = NetworkScreen::Get(screen_manager()); |
1228 network_screen->SetApplicationLocaleAndInputMethod(lang, keyboard_layout); | 1233 network_screen->SetApplicationLocaleAndInputMethod(lang, keyboard_layout); |
1229 network_screen->SetTimezone(timezone); | 1234 network_screen->SetTimezone(timezone); |
1230 | 1235 |
1231 // Don't block the OOBE update and the following enrollment process if there | 1236 // Don't block the OOBE update and the following enrollment process if there |
1232 // is available and valid network already. | 1237 // is available and valid network already. |
1233 const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() | 1238 const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() |
1234 ->network_state_handler() | 1239 ->network_state_handler() |
1235 ->DefaultNetwork(); | 1240 ->DefaultNetwork(); |
1236 if (NetworkAllowUpdate(network_state)) | 1241 if (NetworkAllowUpdate(network_state)) |
1237 InitiateOOBEUpdate(); | 1242 InitiateOOBEUpdate(); |
1238 } | 1243 } |
1239 | 1244 |
1240 void WizardController::AddNetworkRequested(const std::string& onc_spec) { | 1245 void WizardController::AddNetworkRequested(const std::string& onc_spec) { |
1241 remora_controller_->OnNetworkConnectivityChanged( | 1246 remora_controller_->OnNetworkConnectivityChanged( |
1242 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTING); | 1247 pairing_chromeos::HostPairingController::CONNECTIVITY_CONNECTING); |
1243 | 1248 |
1244 NetworkScreen* network_screen = NetworkScreen::Get(this); | 1249 NetworkScreen* network_screen = NetworkScreen::Get(screen_manager()); |
1245 const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() | 1250 const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get() |
1246 ->network_state_handler() | 1251 ->network_state_handler() |
1247 ->DefaultNetwork(); | 1252 ->DefaultNetwork(); |
1248 | 1253 |
1249 if (NetworkAllowUpdate(network_state)) { | 1254 if (NetworkAllowUpdate(network_state)) { |
1250 network_screen->CreateAndConnectNetworkFromOnc( | 1255 network_screen->CreateAndConnectNetworkFromOnc( |
1251 onc_spec, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); | 1256 onc_spec, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); |
1252 } else { | 1257 } else { |
1253 network_screen->CreateAndConnectNetworkFromOnc( | 1258 network_screen->CreateAndConnectNetworkFromOnc( |
1254 onc_spec, base::Bind(&WizardController::OnSetHostNetworkSuccessful, | 1259 onc_spec, base::Bind(&WizardController::OnSetHostNetworkSuccessful, |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 // manual enrollment is taking place. | 1504 // manual enrollment is taking place. |
1500 policy::EnrollmentConfig effective_config = prescribed_enrollment_config_; | 1505 policy::EnrollmentConfig effective_config = prescribed_enrollment_config_; |
1501 if (!effective_config.should_enroll() || | 1506 if (!effective_config.should_enroll() || |
1502 (force_interactive && !effective_config.should_enroll_interactively())) { | 1507 (force_interactive && !effective_config.should_enroll_interactively())) { |
1503 effective_config.mode = | 1508 effective_config.mode = |
1504 prescribed_enrollment_config_.management_domain.empty() | 1509 prescribed_enrollment_config_.management_domain.empty() |
1505 ? policy::EnrollmentConfig::MODE_MANUAL | 1510 ? policy::EnrollmentConfig::MODE_MANUAL |
1506 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; | 1511 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; |
1507 } | 1512 } |
1508 | 1513 |
1509 EnrollmentScreen* screen = EnrollmentScreen::Get(this); | 1514 EnrollmentScreen* screen = EnrollmentScreen::Get(screen_manager()); |
1510 screen->SetParameters(effective_config, shark_controller_.get()); | 1515 screen->SetParameters(effective_config, shark_controller_.get()); |
1511 SetStatusAreaVisible(true); | 1516 SetStatusAreaVisible(true); |
1512 SetCurrentScreen(screen); | 1517 SetCurrentScreen(screen); |
1513 } | 1518 } |
1514 | 1519 |
1515 } // namespace chromeos | 1520 } // namespace chromeos |
OLD | NEW |