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/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/chromeos/login/wizard_controller.h" | 9 #include "chrome/browser/chromeos/login/wizard_controller.h" |
10 #include "chromeos/chromeos_switches.h" | 10 #include "components/pairing/bluetooth_controller_pairing_controller.h" |
11 #include "components/pairing/fake_controller_pairing_controller.h" | |
12 #include "google_apis/gaia/gaia_auth_util.h" | 11 #include "google_apis/gaia/gaia_auth_util.h" |
13 | 12 |
14 using namespace chromeos::controller_pairing; | 13 using namespace chromeos::controller_pairing; |
15 using namespace pairing_chromeos; | 14 using namespace pairing_chromeos; |
16 | 15 |
17 namespace { | 16 namespace { |
18 const char* kTestAuthToken = "TestAuthToken"; | 17 const char* kTestAuthToken = "TestAuthToken"; |
19 }; | 18 }; |
20 | 19 |
21 namespace chromeos { | 20 namespace chromeos { |
22 | 21 |
23 ControllerPairingScreen::ControllerPairingScreen( | 22 ControllerPairingScreen::ControllerPairingScreen( |
24 ScreenObserver* observer, | 23 ScreenObserver* observer, |
25 ControllerPairingScreenActor* actor) | 24 ControllerPairingScreenActor* actor) |
26 : WizardScreen(observer), | 25 : WizardScreen(observer), |
27 actor_(actor), | 26 actor_(actor), |
28 current_stage_(ControllerPairingController::STAGE_NONE), | 27 current_stage_(ControllerPairingController::STAGE_NONE), |
29 device_preselected_(false) { | 28 device_preselected_(false) { |
30 actor_->SetDelegate(this); | 29 actor_->SetDelegate(this); |
31 std::string controller_config = | 30 controller_.reset(new BluetoothControllerPairingController()); |
32 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
33 switches::kShowControllerPairingDemo); | |
34 controller_.reset(new FakeControllerPairingController(controller_config)); | |
35 controller_->AddObserver(this); | 31 controller_->AddObserver(this); |
36 } | 32 } |
37 | 33 |
38 ControllerPairingScreen::~ControllerPairingScreen() { | 34 ControllerPairingScreen::~ControllerPairingScreen() { |
39 if (actor_) | 35 if (actor_) |
40 actor_->SetDelegate(NULL); | 36 actor_->SetDelegate(NULL); |
41 controller_->RemoveObserver(this); | 37 controller_->RemoveObserver(this); |
42 } | 38 } |
43 | 39 |
44 void ControllerPairingScreen::CommitContextChanges() { | 40 void ControllerPairingScreen::CommitContextChanges() { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 ++key) { | 218 ++key) { |
223 if (*key == kContextKeySelectedDevice) { | 219 if (*key == kContextKeySelectedDevice) { |
224 context_.SetBoolean(kContextKeyControlsDisabled, | 220 context_.SetBoolean(kContextKeyControlsDisabled, |
225 context_.GetString(*key).empty()); | 221 context_.GetString(*key).empty()); |
226 CommitContextChanges(); | 222 CommitContextChanges(); |
227 } | 223 } |
228 } | 224 } |
229 } | 225 } |
230 | 226 |
231 } // namespace chromeos | 227 } // namespace chromeos |
OLD | NEW |