| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/screens/controller_pairing_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/controller_pairing_screen.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/login/wizard_controller.h" | 10 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 11 #include "google_apis/gaia/gaia_auth_util.h" | 11 #include "google_apis/gaia/gaia_auth_util.h" |
| 12 | 12 |
| 13 using namespace chromeos::controller_pairing; | 13 using namespace chromeos::controller_pairing; |
| 14 using namespace pairing_chromeos; | 14 using namespace pairing_chromeos; |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 ControllerPairingScreen::ControllerPairingScreen( | 18 ControllerPairingScreen::ControllerPairingScreen( |
| 19 BaseScreenDelegate* base_screen_delegate, | 19 BaseScreenDelegate* base_screen_delegate, |
| 20 Delegate* delegate, | 20 Delegate* delegate, |
| 21 ControllerPairingScreenActor* actor, | 21 ControllerPairingScreenActor* actor, |
| 22 ControllerPairingController* shark_controller) | 22 ControllerPairingController* shark_controller) |
| 23 : BaseScreen(base_screen_delegate), | 23 : BaseScreen(base_screen_delegate, |
| 24 WizardController::kControllerPairingScreenName), |
| 24 delegate_(delegate), | 25 delegate_(delegate), |
| 25 actor_(actor), | 26 actor_(actor), |
| 26 shark_controller_(shark_controller), | 27 shark_controller_(shark_controller), |
| 27 current_stage_(ControllerPairingController::STAGE_NONE), | 28 current_stage_(ControllerPairingController::STAGE_NONE), |
| 28 device_preselected_(false) { | 29 device_preselected_(false) { |
| 29 actor_->SetDelegate(this); | 30 actor_->SetDelegate(this); |
| 30 shark_controller_->AddObserver(this); | 31 shark_controller_->AddObserver(this); |
| 31 } | 32 } |
| 32 | 33 |
| 33 ControllerPairingScreen::~ControllerPairingScreen() { | 34 ControllerPairingScreen::~ControllerPairingScreen() { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 57 if (actor_) | 58 if (actor_) |
| 58 actor_->Show(); | 59 actor_->Show(); |
| 59 shark_controller_->StartPairing(); | 60 shark_controller_->StartPairing(); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void ControllerPairingScreen::Hide() { | 63 void ControllerPairingScreen::Hide() { |
| 63 if (actor_) | 64 if (actor_) |
| 64 actor_->Hide(); | 65 actor_->Hide(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 std::string ControllerPairingScreen::GetName() const { | |
| 68 return WizardController::kControllerPairingScreenName; | |
| 69 } | |
| 70 | |
| 71 void ControllerPairingScreen::PairingStageChanged(Stage new_stage) { | 68 void ControllerPairingScreen::PairingStageChanged(Stage new_stage) { |
| 72 DCHECK(new_stage != current_stage_); | 69 DCHECK(new_stage != current_stage_); |
| 73 | 70 |
| 74 std::string desired_page; | 71 std::string desired_page; |
| 75 switch (new_stage) { | 72 switch (new_stage) { |
| 76 case ControllerPairingController::STAGE_DEVICES_DISCOVERY: { | 73 case ControllerPairingController::STAGE_DEVICES_DISCOVERY: { |
| 77 desired_page = kPageDevicesDiscovery; | 74 desired_page = kPageDevicesDiscovery; |
| 78 context_.SetStringList(kContextKeyDevices, ::login::StringList()); | 75 context_.SetStringList(kContextKeyDevices, ::login::StringList()); |
| 79 context_.SetString(kContextKeySelectedDevice, std::string()); | 76 context_.SetString(kContextKeySelectedDevice, std::string()); |
| 80 device_preselected_ = false; | 77 device_preselected_ = false; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 ++key) { | 209 ++key) { |
| 213 if (*key == kContextKeySelectedDevice) { | 210 if (*key == kContextKeySelectedDevice) { |
| 214 context_.SetBoolean(kContextKeyControlsDisabled, | 211 context_.SetBoolean(kContextKeyControlsDisabled, |
| 215 context_.GetString(*key).empty()); | 212 context_.GetString(*key).empty()); |
| 216 CommitContextChanges(); | 213 CommitContextChanges(); |
| 217 } | 214 } |
| 218 } | 215 } |
| 219 } | 216 } |
| 220 | 217 |
| 221 } // namespace chromeos | 218 } // namespace chromeos |
| OLD | NEW |