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 <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 | 10 |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 ShowLoginScreen(LoginScreenContext()); | 609 ShowLoginScreen(LoginScreenContext()); |
610 } | 610 } |
611 | 611 |
612 void WizardController::OnUpdateCompleted() { | 612 void WizardController::OnUpdateCompleted() { |
613 const bool is_shark = g_browser_process->platform_part() | 613 const bool is_shark = g_browser_process->platform_part() |
614 ->browser_policy_connector_chromeos() | 614 ->browser_policy_connector_chromeos() |
615 ->GetDeviceCloudPolicyManager() | 615 ->GetDeviceCloudPolicyManager() |
616 ->IsSharkRequisition(); | 616 ->IsSharkRequisition(); |
617 if (is_shark || IsBootstrappingMaster()) { | 617 if (is_shark || IsBootstrappingMaster()) { |
618 ShowControllerPairingScreen(); | 618 ShowControllerPairingScreen(); |
619 } else if (IsBootstrappingSlave()) { | 619 } else if (IsBootstrappingSlave() && shark_controller_detected_) { |
620 ShowHostPairingScreen(); | 620 ShowHostPairingScreen(); |
621 } else { | 621 } else { |
622 ShowAutoEnrollmentCheckScreen(); | 622 ShowAutoEnrollmentCheckScreen(); |
623 } | 623 } |
624 } | 624 } |
625 | 625 |
626 void WizardController::OnEulaAccepted() { | 626 void WizardController::OnEulaAccepted() { |
627 time_eula_accepted_ = base::Time::Now(); | 627 time_eula_accepted_ = base::Time::Now(); |
628 StartupUtils::MarkEulaAccepted(); | 628 StartupUtils::MarkEulaAccepted(); |
629 InitiateMetricsReportingChange( | 629 InitiateMetricsReportingChange( |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 bool WizardController::SetOnTimeZoneResolvedForTesting( | 1319 bool WizardController::SetOnTimeZoneResolvedForTesting( |
1320 const base::Closure& callback) { | 1320 const base::Closure& callback) { |
1321 if (timezone_resolved_) | 1321 if (timezone_resolved_) |
1322 return false; | 1322 return false; |
1323 | 1323 |
1324 on_timezone_resolved_for_testing_ = callback; | 1324 on_timezone_resolved_for_testing_ = callback; |
1325 return true; | 1325 return true; |
1326 } | 1326 } |
1327 | 1327 |
1328 bool WizardController::IsHostPairingOobe() const { | 1328 bool WizardController::IsHostPairingOobe() const { |
1329 return IsRemoraRequisition() && | 1329 return (IsRemoraRequisition() || IsBootstrappingSlave()) && |
1330 (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1330 (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1331 switches::kHostPairingOobe) || | 1331 switches::kHostPairingOobe) || |
1332 shark_controller_detected_); | 1332 shark_controller_detected_); |
1333 } | 1333 } |
1334 | 1334 |
1335 void WizardController::MaybeStartListeningForSharkConnection() { | 1335 void WizardController::MaybeStartListeningForSharkConnection() { |
1336 if (!IsRemoraRequisition() && !IsBootstrappingSlave()) | 1336 if (!IsRemoraRequisition() && !IsBootstrappingSlave()) |
1337 return; | 1337 return; |
1338 | 1338 |
1339 // We shouldn't be here if we are running pairing OOBE already. | 1339 // We shouldn't be here if we are running pairing OOBE already. |
1340 DCHECK(!IsHostPairingOobe()); | 1340 DCHECK(!IsHostPairingOobe()); |
1341 | 1341 |
1342 if (!shark_connection_listener_) { | 1342 if (!shark_connection_listener_) { |
1343 shark_connection_listener_.reset( | 1343 shark_connection_listener_.reset( |
1344 new pairing_chromeos::SharkConnectionListener( | 1344 new pairing_chromeos::SharkConnectionListener( |
1345 base::Bind(&WizardController::OnSharkConnected, | 1345 base::Bind(&WizardController::OnSharkConnected, |
1346 weak_factory_.GetWeakPtr()))); | 1346 weak_factory_.GetWeakPtr()))); |
1347 } | 1347 } |
1348 } | 1348 } |
1349 | 1349 |
1350 void WizardController::OnSharkConnected( | 1350 void WizardController::OnSharkConnected( |
1351 scoped_ptr<pairing_chromeos::HostPairingController> remora_controller) { | 1351 scoped_ptr<pairing_chromeos::HostPairingController> remora_controller) { |
1352 VLOG(1) << "OnSharkConnected"; | 1352 VLOG(1) << "OnSharkConnected"; |
1353 remora_controller_ = remora_controller.Pass(); | 1353 remora_controller_ = remora_controller.Pass(); |
1354 base::MessageLoop::current()->DeleteSoon( | 1354 base::MessageLoop::current()->DeleteSoon( |
1355 FROM_HERE, shark_connection_listener_.release()); | 1355 FROM_HERE, shark_connection_listener_.release()); |
1356 shark_controller_detected_ = true; | 1356 shark_controller_detected_ = true; |
1357 | |
1358 if (IsBootstrappingSlave()) { | |
1359 g_browser_process->platform_part() | |
1360 ->browser_policy_connector_chromeos() | |
1361 ->GetDeviceCloudPolicyManager() | |
1362 ->SetDeviceEnrollmentAutoStart(); | |
1363 } | |
1364 | |
1365 ShowHostPairingScreen(); | 1357 ShowHostPairingScreen(); |
1366 } | 1358 } |
1367 | 1359 |
1368 void WizardController::OnSetHostNetworkFailed() { | 1360 void WizardController::OnSetHostNetworkFailed() { |
1369 remora_controller_->OnNetworkConnectivityChanged( | 1361 remora_controller_->OnNetworkConnectivityChanged( |
1370 pairing_chromeos::HostPairingController::CONNECTIVITY_NONE); | 1362 pairing_chromeos::HostPairingController::CONNECTIVITY_NONE); |
1371 } | 1363 } |
1372 | 1364 |
1373 void WizardController::StartEnrollmentScreen() { | 1365 void WizardController::StartEnrollmentScreen() { |
1374 VLOG(1) << "Showing enrollment screen."; | 1366 VLOG(1) << "Showing enrollment screen."; |
1375 | 1367 |
1376 // Determine the effective enrollment configuration. If there is a valid | 1368 // Determine the effective enrollment configuration. If there is a valid |
1377 // prescribed configuration, use that. If not, figure out which variant of | 1369 // prescribed configuration, use that. If not, figure out which variant of |
1378 // manual enrollment is taking place. | 1370 // manual enrollment is taking place. |
1379 policy::EnrollmentConfig effective_config = prescribed_enrollment_config_; | 1371 policy::EnrollmentConfig effective_config = prescribed_enrollment_config_; |
1380 if (!effective_config.should_enroll()) { | 1372 if (!effective_config.should_enroll()) { |
1381 effective_config.mode = | 1373 effective_config.mode = |
1382 prescribed_enrollment_config_.management_domain.empty() | 1374 prescribed_enrollment_config_.management_domain.empty() |
1383 ? policy::EnrollmentConfig::MODE_MANUAL | 1375 ? policy::EnrollmentConfig::MODE_MANUAL |
1384 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; | 1376 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; |
1385 } | 1377 } |
1386 | 1378 |
1387 EnrollmentScreen* screen = EnrollmentScreen::Get(this); | 1379 EnrollmentScreen* screen = EnrollmentScreen::Get(this); |
1388 screen->SetParameters(effective_config, shark_controller_.get()); | 1380 screen->SetParameters(effective_config, shark_controller_.get()); |
1389 SetStatusAreaVisible(true); | 1381 SetStatusAreaVisible(true); |
1390 SetCurrentScreen(screen); | 1382 SetCurrentScreen(screen); |
1391 } | 1383 } |
1392 | 1384 |
1393 } // namespace chromeos | 1385 } // namespace chromeos |
OLD | NEW |