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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // and changes from call to call. | 126 // and changes from call to call. |
127 base::HistogramBase* histogram = base::Histogram::FactoryTimeGet( | 127 base::HistogramBase* histogram = base::Histogram::FactoryTimeGet( |
128 histogram_name, | 128 histogram_name, |
129 base::TimeDelta::FromMilliseconds(10), | 129 base::TimeDelta::FromMilliseconds(10), |
130 base::TimeDelta::FromMinutes(3), | 130 base::TimeDelta::FromMinutes(3), |
131 50, | 131 50, |
132 base::HistogramBase::kUmaTargetedHistogramFlag); | 132 base::HistogramBase::kUmaTargetedHistogramFlag); |
133 histogram->AddTime(step_time); | 133 histogram->AddTime(step_time); |
134 } | 134 } |
135 | 135 |
136 bool IsRemoraRequisition() { | 136 bool IsBootstrappingRemora() { |
137 return g_browser_process->platform_part() | 137 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
138 ->browser_policy_connector_chromeos() | 138 chromeos::switches::kOobeBootstrappingRemora); |
139 ->GetDeviceCloudPolicyManager() | 139 } |
140 ->IsRemoraRequisition(); | 140 |
| 141 bool IsBootstrappingShark() { |
| 142 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 143 chromeos::switches::kOobeBootstrappingShark); |
141 } | 144 } |
142 | 145 |
143 #if defined(GOOGLE_CHROME_BUILD) | 146 #if defined(GOOGLE_CHROME_BUILD) |
144 void InitializeCrashReporter() { | 147 void InitializeCrashReporter() { |
145 // The crash reporter initialization needs IO to complete. | 148 // The crash reporter initialization needs IO to complete. |
146 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 149 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
147 breakpad::InitCrashReporter(std::string()); | 150 breakpad::InitCrashReporter(std::string()); |
148 } | 151 } |
149 #endif | 152 #endif |
150 | 153 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 if (status == PrefService::INITIALIZATION_STATUS_ERROR) { | 266 if (status == PrefService::INITIALIZATION_STATUS_ERROR) { |
264 OnLocalStateInitialized(false); | 267 OnLocalStateInitialized(false); |
265 return; | 268 return; |
266 } else if (status == PrefService::INITIALIZATION_STATUS_WAITING) { | 269 } else if (status == PrefService::INITIALIZATION_STATUS_WAITING) { |
267 GetLocalState()->AddPrefInitObserver( | 270 GetLocalState()->AddPrefInitObserver( |
268 base::Bind(&WizardController::OnLocalStateInitialized, | 271 base::Bind(&WizardController::OnLocalStateInitialized, |
269 weak_factory_.GetWeakPtr())); | 272 weak_factory_.GetWeakPtr())); |
270 } | 273 } |
271 } | 274 } |
272 | 275 |
| 276 // If the device is remora or shark, start the enrollment OOBE process. |
| 277 if (IsBootstrappingRemora() || IsBootstrappingShark()) |
| 278 GetLocalState()->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true); |
| 279 |
273 // Use the saved screen preference from Local State. | 280 // Use the saved screen preference from Local State. |
274 const std::string screen_pref = | 281 const std::string screen_pref = |
275 GetLocalState()->GetString(prefs::kOobeScreenPending); | 282 GetLocalState()->GetString(prefs::kOobeScreenPending); |
276 if (is_out_of_box_ && !screen_pref.empty() && !IsHostPairingOobe() && | 283 if (is_out_of_box_ && !screen_pref.empty() && !IsBootstrappingRemoraOobe() && |
277 (first_screen_name.empty() || | 284 (first_screen_name.empty() || |
278 first_screen_name == WizardController::kTestNoScreenName)) { | 285 first_screen_name == WizardController::kTestNoScreenName)) { |
279 first_screen_name_ = screen_pref; | 286 first_screen_name_ = screen_pref; |
280 } | 287 } |
281 | 288 |
282 AdvanceToScreen(first_screen_name_); | 289 AdvanceToScreen(first_screen_name_); |
283 if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() && | 290 if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() && |
284 first_screen_name_.empty()) | 291 first_screen_name_.empty()) |
285 ShowWrongHWIDScreen(); | 292 ShowWrongHWIDScreen(); |
286 } | 293 } |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 // should report some error message here and stay on the same screen. | 581 // should report some error message here and stay on the same screen. |
575 ShowLoginScreen(LoginScreenContext()); | 582 ShowLoginScreen(LoginScreenContext()); |
576 } | 583 } |
577 | 584 |
578 void WizardController::OnConnectionFailed() { | 585 void WizardController::OnConnectionFailed() { |
579 // TODO(dpolukhin): show error message after login screen is displayed. | 586 // TODO(dpolukhin): show error message after login screen is displayed. |
580 ShowLoginScreen(LoginScreenContext()); | 587 ShowLoginScreen(LoginScreenContext()); |
581 } | 588 } |
582 | 589 |
583 void WizardController::OnUpdateCompleted() { | 590 void WizardController::OnUpdateCompleted() { |
584 const bool is_shark = g_browser_process->platform_part() | 591 if (IsBootstrappingShark()) { |
585 ->browser_policy_connector_chromeos() | |
586 ->GetDeviceCloudPolicyManager() | |
587 ->IsSharkRequisition(); | |
588 if (is_shark) { | |
589 ShowControllerPairingScreen(); | 592 ShowControllerPairingScreen(); |
590 } else { | 593 } else { |
591 ShowAutoEnrollmentCheckScreen(); | 594 ShowAutoEnrollmentCheckScreen(); |
592 } | 595 } |
593 } | 596 } |
594 | 597 |
595 void WizardController::OnEulaAccepted() { | 598 void WizardController::OnEulaAccepted() { |
596 time_eula_accepted_ = base::Time::Now(); | 599 time_eula_accepted_ = base::Time::Now(); |
597 StartupUtils::MarkEulaAccepted(); | 600 StartupUtils::MarkEulaAccepted(); |
598 InitiateMetricsReportingChange( | 601 InitiateMetricsReportingChange( |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 ShowHIDDetectionScreen(); | 917 ShowHIDDetectionScreen(); |
915 } else if (screen_name == kControllerPairingScreenName) { | 918 } else if (screen_name == kControllerPairingScreenName) { |
916 ShowControllerPairingScreen(); | 919 ShowControllerPairingScreen(); |
917 } else if (screen_name == kHostPairingScreenName) { | 920 } else if (screen_name == kHostPairingScreenName) { |
918 ShowHostPairingScreen(); | 921 ShowHostPairingScreen(); |
919 } else if (screen_name == kDeviceDisabledScreenName) { | 922 } else if (screen_name == kDeviceDisabledScreenName) { |
920 ShowDeviceDisabledScreen(); | 923 ShowDeviceDisabledScreen(); |
921 } else if (screen_name != kTestNoScreenName) { | 924 } else if (screen_name != kTestNoScreenName) { |
922 if (is_out_of_box_) { | 925 if (is_out_of_box_) { |
923 time_oobe_started_ = base::Time::Now(); | 926 time_oobe_started_ = base::Time::Now(); |
924 if (IsHostPairingOobe()) { | 927 if (IsBootstrappingRemoraOobe()) { |
925 ShowHostPairingScreen(); | 928 ShowHostPairingScreen(); |
926 } else if (CanShowHIDDetectionScreen()) { | 929 } else if (CanShowHIDDetectionScreen()) { |
927 hid_screen_ = GetScreen(kHIDDetectionScreenName); | 930 hid_screen_ = GetScreen(kHIDDetectionScreenName); |
928 base::Callback<void(bool)> on_check = base::Bind( | 931 base::Callback<void(bool)> on_check = base::Bind( |
929 &WizardController::OnHIDScreenNecessityCheck, | 932 &WizardController::OnHIDScreenNecessityCheck, |
930 weak_factory_.GetWeakPtr()); | 933 weak_factory_.GetWeakPtr()); |
931 oobe_display_->GetHIDDetectionView()->CheckIsScreenRequired(on_check); | 934 oobe_display_->GetHIDDetectionView()->CheckIsScreenRequired(on_check); |
932 } else { | 935 } else { |
933 ShowNetworkScreen(); | 936 ShowNetworkScreen(); |
934 } | 937 } |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 | 1275 |
1273 bool WizardController::SetOnTimeZoneResolvedForTesting( | 1276 bool WizardController::SetOnTimeZoneResolvedForTesting( |
1274 const base::Closure& callback) { | 1277 const base::Closure& callback) { |
1275 if (timezone_resolved_) | 1278 if (timezone_resolved_) |
1276 return false; | 1279 return false; |
1277 | 1280 |
1278 on_timezone_resolved_for_testing_ = callback; | 1281 on_timezone_resolved_for_testing_ = callback; |
1279 return true; | 1282 return true; |
1280 } | 1283 } |
1281 | 1284 |
1282 bool WizardController::IsHostPairingOobe() const { | 1285 bool WizardController::IsBootstrappingRemoraOobe() const { |
1283 return IsRemoraRequisition() && | 1286 return IsBootstrappingRemora() && shark_controller_detected_; |
1284 (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
1285 switches::kHostPairingOobe) || | |
1286 shark_controller_detected_); | |
1287 } | 1287 } |
1288 | 1288 |
1289 void WizardController::MaybeStartListeningForSharkConnection() { | 1289 void WizardController::MaybeStartListeningForSharkConnection() { |
1290 if (!IsRemoraRequisition()) | 1290 if (!IsBootstrappingRemora()) |
1291 return; | 1291 return; |
1292 | 1292 |
1293 // We shouldn't be here if we are running pairing OOBE already. | 1293 // We shouldn't be here if we are running bootstrapping OOBE already. |
1294 DCHECK(!IsHostPairingOobe()); | 1294 DCHECK(!IsBootstrappingRemoraOobe()); |
1295 | 1295 |
1296 if (!shark_connection_listener_) { | 1296 if (!shark_connection_listener_) { |
1297 shark_connection_listener_.reset( | 1297 shark_connection_listener_.reset( |
1298 new pairing_chromeos::SharkConnectionListener( | 1298 new pairing_chromeos::SharkConnectionListener( |
1299 base::Bind(&WizardController::OnSharkConnected, | 1299 base::Bind(&WizardController::OnSharkConnected, |
1300 weak_factory_.GetWeakPtr()))); | 1300 weak_factory_.GetWeakPtr()))); |
1301 } | 1301 } |
1302 } | 1302 } |
1303 | 1303 |
1304 void WizardController::OnSharkConnected( | 1304 void WizardController::OnSharkConnected( |
(...skipping 21 matching lines...) Expand all Loading... |
1326 } | 1326 } |
1327 | 1327 |
1328 EnrollmentScreen* screen = EnrollmentScreen::Get(this); | 1328 EnrollmentScreen* screen = EnrollmentScreen::Get(this); |
1329 screen->SetParameters(effective_config, shark_controller_.get(), | 1329 screen->SetParameters(effective_config, shark_controller_.get(), |
1330 remora_controller_.get()); | 1330 remora_controller_.get()); |
1331 SetStatusAreaVisible(true); | 1331 SetStatusAreaVisible(true); |
1332 SetCurrentScreen(screen); | 1332 SetCurrentScreen(screen); |
1333 } | 1333 } |
1334 | 1334 |
1335 } // namespace chromeos | 1335 } // namespace chromeos |
OLD | NEW |