| Index: chrome/browser/chromeos/login/wizard_controller.cc
|
| diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
|
| index fc04d740688a71da505a2363e3d6d9d91f9b2f6e..f1b3b33d8559fef8d2f69703b536bccc706f6bfe 100644
|
| --- a/chrome/browser/chromeos/login/wizard_controller.cc
|
| +++ b/chrome/browser/chromeos/login/wizard_controller.cc
|
| @@ -143,17 +143,10 @@
|
| ->IsRemoraRequisition();
|
| }
|
|
|
| -// Checks if a controller device ("Master") is detected during the bootstrapping
|
| -// or shark/remora setup process.
|
| -bool IsControllerDetected() {
|
| - return g_browser_process->local_state()->GetBoolean(
|
| - prefs::kOobeControllerDetected);
|
| -}
|
| -
|
| -void SetControllerDetectedPref(bool value) {
|
| - PrefService* prefs = g_browser_process->local_state();
|
| - prefs->SetBoolean(prefs::kOobeControllerDetected, value);
|
| - prefs->CommitPendingWrite();
|
| +// Checks if the device is a "Slave" device in the bootstrapping process.
|
| +bool IsBootstrappingSlave() {
|
| + return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + chromeos::switches::kOobeBootstrappingSlave);
|
| }
|
|
|
| // Checks if the device is a "Master" device in the bootstrapping process.
|
| @@ -249,10 +242,6 @@
|
| }
|
|
|
| WizardController::~WizardController() {
|
| - if (shark_connection_listener_.get()) {
|
| - base::MessageLoop::current()->DeleteSoon(
|
| - FROM_HERE, shark_connection_listener_.release());
|
| - }
|
| if (default_controller_ == this) {
|
| default_controller_ = nullptr;
|
| } else {
|
| @@ -300,15 +289,11 @@
|
| const std::string screen_pref =
|
| GetLocalState()->GetString(prefs::kOobeScreenPending);
|
| if (is_out_of_box_ && !screen_pref.empty() && !IsRemoraPairingOobe() &&
|
| - !IsControllerDetected() &&
|
| + !IsBootstrappingSlave() &&
|
| (first_screen_name.empty() ||
|
| first_screen_name == WizardController::kTestNoScreenName)) {
|
| first_screen_name_ = screen_pref;
|
| }
|
| - // We need to reset the kOobeControllerDetected pref to allow the user to have
|
| - // the choice to setup the device manually. The pref will be set properly if
|
| - // an eligible controller is detected later.
|
| - SetControllerDetectedPref(false);
|
|
|
| AdvanceToScreen(first_screen_name_);
|
| if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() &&
|
| @@ -618,7 +603,7 @@
|
| ->IsSharkRequisition();
|
| if (is_shark || IsBootstrappingMaster()) {
|
| ShowControllerPairingScreen();
|
| - } else if (IsControllerDetected()) {
|
| + } else if (IsBootstrappingSlave() && shark_controller_detected_) {
|
| ShowHostPairingScreen();
|
| } else {
|
| ShowAutoEnrollmentCheckScreen();
|
| @@ -952,7 +937,7 @@
|
| } else if (screen_name != kTestNoScreenName) {
|
| if (is_out_of_box_) {
|
| time_oobe_started_ = base::Time::Now();
|
| - if (IsRemoraPairingOobe() || IsControllerDetected()) {
|
| + if (IsRemoraPairingOobe() || IsSlavePairingOobe()) {
|
| ShowHostPairingScreen();
|
| } else if (CanShowHIDDetectionScreen()) {
|
| hid_screen_ = GetScreen(kHIDDetectionScreenName);
|
| @@ -1329,14 +1314,22 @@
|
| }
|
|
|
| bool WizardController::IsRemoraPairingOobe() const {
|
| - return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kHostPairingOobe);
|
| + return IsRemoraRequisition() &&
|
| + (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kHostPairingOobe) ||
|
| + shark_controller_detected_);
|
| +}
|
| +
|
| +bool WizardController::IsSlavePairingOobe() const {
|
| + return IsBootstrappingSlave() && shark_controller_detected_;
|
| }
|
|
|
| void WizardController::MaybeStartListeningForSharkConnection() {
|
| + if (!IsRemoraRequisition() && !IsBootstrappingSlave())
|
| + return;
|
| +
|
| // We shouldn't be here if we are running pairing OOBE already.
|
| - if (IsControllerDetected())
|
| - return;
|
| + DCHECK(!IsRemoraPairingOobe() && !IsSlavePairingOobe());
|
|
|
| if (!shark_connection_listener_) {
|
| shark_connection_listener_.reset(
|
| @@ -1352,7 +1345,7 @@
|
| remora_controller_ = std::move(remora_controller);
|
| base::MessageLoop::current()->DeleteSoon(
|
| FROM_HERE, shark_connection_listener_.release());
|
| - SetControllerDetectedPref(true);
|
| + shark_controller_detected_ = true;
|
| ShowHostPairingScreen();
|
| }
|
|
|
|
|