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 "components/pairing/shark_connection_listener.h" | 5 #include "components/pairing/shark_connection_listener.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/task_runner.h" |
10 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
11 #include "components/pairing/bluetooth_host_pairing_controller.h" | 12 #include "components/pairing/bluetooth_host_pairing_controller.h" |
12 | 13 |
13 namespace pairing_chromeos { | 14 namespace pairing_chromeos { |
14 | 15 |
15 SharkConnectionListener::SharkConnectionListener( | 16 SharkConnectionListener::SharkConnectionListener( |
16 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner, | 17 scoped_refptr<base::TaskRunner> input_service_task_runner, |
17 OnConnectedCallback callback) | 18 OnConnectedCallback callback) |
18 : callback_(callback) { | 19 : callback_(callback) { |
19 controller_.reset(new BluetoothHostPairingController(file_task_runner)); | 20 controller_.reset( |
| 21 new BluetoothHostPairingController(std::move(input_service_task_runner))); |
20 controller_->AddObserver(this); | 22 controller_->AddObserver(this); |
21 controller_->StartPairing(); | 23 controller_->StartPairing(); |
22 } | 24 } |
23 | 25 |
24 SharkConnectionListener::~SharkConnectionListener() { | 26 SharkConnectionListener::~SharkConnectionListener() { |
25 if (controller_.get()) | 27 if (controller_.get()) |
26 controller_->RemoveObserver(this); | 28 controller_->RemoveObserver(this); |
27 } | 29 } |
28 | 30 |
29 void SharkConnectionListener::ResetController() { | 31 void SharkConnectionListener::ResetController() { |
(...skipping 14 matching lines...) Expand all Loading... |
44 || new_stage == HostPairingController::STAGE_SETUP_BASIC_CONFIGURATION) { | 46 || new_stage == HostPairingController::STAGE_SETUP_BASIC_CONFIGURATION) { |
45 controller_->RemoveObserver(this); | 47 controller_->RemoveObserver(this); |
46 callback_.Run(std::move(controller_)); | 48 callback_.Run(std::move(controller_)); |
47 callback_.Reset(); | 49 callback_.Reset(); |
48 } else if (new_stage != HostPairingController::STAGE_WAITING_FOR_CONTROLLER) { | 50 } else if (new_stage != HostPairingController::STAGE_WAITING_FOR_CONTROLLER) { |
49 LOG(ERROR) << "Unexpected stage " << new_stage; | 51 LOG(ERROR) << "Unexpected stage " << new_stage; |
50 } | 52 } |
51 } | 53 } |
52 | 54 |
53 } // namespace pairing_chromeos | 55 } // namespace pairing_chromeos |
OLD | NEW |