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