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/host_pairing_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/host_pairing_screen.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/chromeos/login/wizard_controller.h" | 8 #include "chrome/browser/chromeos/login/wizard_controller.h" |
9 #include "chromeos/chromeos_switches.h" | 9 #include "components/pairing/bluetooth_host_pairing_controller.h" |
10 #include "components/pairing/fake_host_pairing_controller.h" | |
11 | 10 |
12 namespace chromeos { | 11 namespace chromeos { |
13 | 12 |
14 using namespace host_pairing; | 13 using namespace host_pairing; |
15 using namespace pairing_chromeos; | 14 using namespace pairing_chromeos; |
16 | 15 |
17 HostPairingScreen::HostPairingScreen(ScreenObserver* observer, | 16 HostPairingScreen::HostPairingScreen(ScreenObserver* observer, |
18 HostPairingScreenActor* actor) | 17 HostPairingScreenActor* actor) |
19 : WizardScreen(observer), | 18 : WizardScreen(observer), |
20 actor_(actor), | 19 actor_(actor), |
21 current_stage_(HostPairingController::STAGE_NONE) { | 20 current_stage_(HostPairingController::STAGE_NONE) { |
22 actor_->SetDelegate(this); | 21 actor_->SetDelegate(this); |
23 std::string controller_config = | 22 controller_.reset(new BluetoothHostPairingController()); |
24 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
25 switches::kShowHostPairingDemo); | |
26 controller_.reset(new FakeHostPairingController(controller_config)); | |
27 controller_->AddObserver(this); | 23 controller_->AddObserver(this); |
28 } | 24 } |
29 | 25 |
30 HostPairingScreen::~HostPairingScreen() { | 26 HostPairingScreen::~HostPairingScreen() { |
31 if (actor_) | 27 if (actor_) |
32 actor_->SetDelegate(NULL); | 28 actor_->SetDelegate(NULL); |
33 controller_->RemoveObserver(this); | 29 controller_->RemoveObserver(this); |
34 } | 30 } |
35 | 31 |
36 void HostPairingScreen::CommitContextChanges() { | 32 void HostPairingScreen::CommitContextChanges() { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // TODO(zork,achuith): Enroll device, send error on error. | 123 // TODO(zork,achuith): Enroll device, send error on error. |
128 // (http://crbug.com/374990) | 124 // (http://crbug.com/374990) |
129 } | 125 } |
130 | 126 |
131 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { | 127 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { |
132 if (actor_ == actor) | 128 if (actor_ == actor) |
133 actor_ = NULL; | 129 actor_ = NULL; |
134 } | 130 } |
135 | 131 |
136 } // namespace chromeos | 132 } // namespace chromeos |
OLD | NEW |