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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 chromeos::WizardController::kTermsOfServiceScreenName, | 101 chromeos::WizardController::kTermsOfServiceScreenName, |
102 chromeos::WizardController::kAutoEnrollmentCheckScreenName | 102 chromeos::WizardController::kAutoEnrollmentCheckScreenName |
103 }; | 103 }; |
104 | 104 |
105 // Checks flag for HID-detection screen show. | 105 // Checks flag for HID-detection screen show. |
106 bool CanShowHIDDetectionScreen() { | 106 bool CanShowHIDDetectionScreen() { |
107 return !CommandLine::ForCurrentProcess()->HasSwitch( | 107 return !CommandLine::ForCurrentProcess()->HasSwitch( |
108 chromeos::switches::kDisableHIDDetectionOnOOBE); | 108 chromeos::switches::kDisableHIDDetectionOnOOBE); |
109 } | 109 } |
110 | 110 |
| 111 // Checks if we are a remora waiting for a shark. |
111 bool ShouldShowHostPairingScreen() { | 112 bool ShouldShowHostPairingScreen() { |
112 return CommandLine::ForCurrentProcess()->HasSwitch( | 113 const bool is_remora = |
| 114 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
| 115 GetDeviceCloudPolicyManager()->IsRemoraRequisition(); |
| 116 const bool pairing_demo = CommandLine::ForCurrentProcess()->HasSwitch( |
113 chromeos::switches::kShowHostPairingDemo); | 117 chromeos::switches::kShowHostPairingDemo); |
| 118 return is_remora && pairing_demo; |
114 } | 119 } |
115 | 120 |
116 bool IsResumableScreen(const std::string& screen) { | 121 bool IsResumableScreen(const std::string& screen) { |
117 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kResumableScreens); ++i) { | 122 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kResumableScreens); ++i) { |
118 if (screen == kResumableScreens[i]) | 123 if (screen == kResumableScreens[i]) |
119 return true; | 124 return true; |
120 } | 125 } |
121 return false; | 126 return false; |
122 } | 127 } |
123 | 128 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 if (status == PrefService::INITIALIZATION_STATUS_ERROR) { | 259 if (status == PrefService::INITIALIZATION_STATUS_ERROR) { |
255 OnLocalStateInitialized(false); | 260 OnLocalStateInitialized(false); |
256 return; | 261 return; |
257 } else if (status == PrefService::INITIALIZATION_STATUS_WAITING) { | 262 } else if (status == PrefService::INITIALIZATION_STATUS_WAITING) { |
258 GetLocalState()->AddPrefInitObserver( | 263 GetLocalState()->AddPrefInitObserver( |
259 base::Bind(&WizardController::OnLocalStateInitialized, | 264 base::Bind(&WizardController::OnLocalStateInitialized, |
260 weak_factory_.GetWeakPtr())); | 265 weak_factory_.GetWeakPtr())); |
261 } | 266 } |
262 } | 267 } |
263 | 268 |
| 269 // Use the saved screen preference from Local State. |
264 const std::string screen_pref = | 270 const std::string screen_pref = |
265 GetLocalState()->GetString(prefs::kOobeScreenPending); | 271 GetLocalState()->GetString(prefs::kOobeScreenPending); |
266 if (is_out_of_box_ && !screen_pref.empty() && (first_screen_name.empty() || | 272 if (is_out_of_box_ && !screen_pref.empty() && |
| 273 !ShouldShowHostPairingScreen() && (first_screen_name.empty() || |
267 first_screen_name == WizardController::kTestNoScreenName)) { | 274 first_screen_name == WizardController::kTestNoScreenName)) { |
268 first_screen_name_ = screen_pref; | 275 first_screen_name_ = screen_pref; |
269 } | 276 } |
270 | 277 |
271 AdvanceToScreen(first_screen_name_); | 278 AdvanceToScreen(first_screen_name_); |
272 if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() && | 279 if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() && |
273 first_screen_name_.empty()) | 280 first_screen_name_.empty()) |
274 ShowWrongHWIDScreen(); | 281 ShowWrongHWIDScreen(); |
275 } | 282 } |
276 | 283 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 } | 572 } |
566 | 573 |
567 void WizardController::OnUpdateCompleted() { | 574 void WizardController::OnUpdateCompleted() { |
568 // TODO(dzhioev): place checks related to pairing in a proper place. | 575 // TODO(dzhioev): place checks related to pairing in a proper place. |
569 const bool is_shark = | 576 const bool is_shark = |
570 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> | 577 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
571 GetDeviceCloudPolicyManager()->IsSharkRequisition(); | 578 GetDeviceCloudPolicyManager()->IsSharkRequisition(); |
572 | 579 |
573 if (is_shark) { | 580 if (is_shark) { |
574 ShowControllerPairingScreen(); | 581 ShowControllerPairingScreen(); |
575 } else if (ShouldShowHostPairingScreen()) { | |
576 ShowHostPairingScreen(); | |
577 } else if (!auth_token_.empty()) { | 582 } else if (!auth_token_.empty()) { |
578 // TODO(achuith): There is an issue with the auto enrollment check and | 583 // TODO(achuith): There is an issue with the auto enrollment check and |
579 // remote enrollment. crbug.com/403147. | 584 // remote enrollment. crbug.com/403147. |
580 ShowEnrollmentScreen(); | 585 ShowEnrollmentScreen(); |
581 } else { | 586 } else { |
582 ShowAutoEnrollmentCheckScreen(); | 587 ShowAutoEnrollmentCheckScreen(); |
583 } | 588 } |
584 } | 589 } |
585 | 590 |
586 void WizardController::OnEulaAccepted() { | 591 void WizardController::OnEulaAccepted() { |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 AutoLaunchKioskApp(); | 896 AutoLaunchKioskApp(); |
892 } else if (screen_name == kHIDDetectionScreenName) { | 897 } else if (screen_name == kHIDDetectionScreenName) { |
893 ShowHIDDetectionScreen(); | 898 ShowHIDDetectionScreen(); |
894 } else if (screen_name == kControllerPairingScreenName) { | 899 } else if (screen_name == kControllerPairingScreenName) { |
895 ShowControllerPairingScreen(); | 900 ShowControllerPairingScreen(); |
896 } else if (screen_name == kHostPairingScreenName) { | 901 } else if (screen_name == kHostPairingScreenName) { |
897 ShowHostPairingScreen(); | 902 ShowHostPairingScreen(); |
898 } else if (screen_name != kTestNoScreenName) { | 903 } else if (screen_name != kTestNoScreenName) { |
899 if (is_out_of_box_) { | 904 if (is_out_of_box_) { |
900 time_oobe_started_ = base::Time::Now(); | 905 time_oobe_started_ = base::Time::Now(); |
901 if (CanShowHIDDetectionScreen()) { | 906 if (ShouldShowHostPairingScreen()) { |
| 907 ShowHostPairingScreen(); |
| 908 } else if (CanShowHIDDetectionScreen()) { |
902 base::Callback<void(bool)> on_check = base::Bind( | 909 base::Callback<void(bool)> on_check = base::Bind( |
903 &WizardController::OnHIDScreenNecessityCheck, | 910 &WizardController::OnHIDScreenNecessityCheck, |
904 weak_factory_.GetWeakPtr()); | 911 weak_factory_.GetWeakPtr()); |
905 oobe_display_->GetHIDDetectionScreenActor()->CheckIsScreenRequired( | 912 oobe_display_->GetHIDDetectionScreenActor()->CheckIsScreenRequired( |
906 on_check); | 913 on_check); |
907 } else { | 914 } else { |
908 ShowNetworkScreen(); | 915 ShowNetworkScreen(); |
909 } | 916 } |
910 } else { | 917 } else { |
911 ShowLoginScreen(LoginScreenContext()); | 918 ShowLoginScreen(LoginScreenContext()); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 bool WizardController::SetOnTimeZoneResolvedForTesting( | 1229 bool WizardController::SetOnTimeZoneResolvedForTesting( |
1223 const base::Closure& callback) { | 1230 const base::Closure& callback) { |
1224 if (timezone_resolved_) | 1231 if (timezone_resolved_) |
1225 return false; | 1232 return false; |
1226 | 1233 |
1227 on_timezone_resolved_for_testing_ = callback; | 1234 on_timezone_resolved_for_testing_ = callback; |
1228 return true; | 1235 return true; |
1229 } | 1236 } |
1230 | 1237 |
1231 } // namespace chromeos | 1238 } // namespace chromeos |
OLD | NEW |