Chromium Code Reviews| 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 #ifndef COMPONENTS_PAIRING_SHARK_CONNECTION_LISTENER_H_ | 5 #ifndef COMPONENTS_PAIRING_SHARK_CONNECTION_LISTENER_H_ |
| 6 #define COMPONENTS_PAIRING_SHARK_CONNECTION_LISTENER_H_ | 6 #define COMPONENTS_PAIRING_SHARK_CONNECTION_LISTENER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/pairing/host_pairing_controller.h" | 13 #include "components/pairing/host_pairing_controller.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class SingleThreadTaskRunner; | 16 class TaskRunner; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace pairing_chromeos { | 19 namespace pairing_chromeos { |
| 20 | 20 |
| 21 class BluetoothHostPairingController; | 21 class BluetoothHostPairingController; |
| 22 | 22 |
| 23 // Listens for incoming connection from shark controller. If connection | 23 // Listens for incoming connection from shark controller. If connection |
| 24 // is established, invokes callback passing HostPairingController | 24 // is established, invokes callback passing HostPairingController |
| 25 // as an argument. | 25 // as an argument. |
| 26 class SharkConnectionListener : public HostPairingController::Observer { | 26 class SharkConnectionListener : public HostPairingController::Observer { |
| 27 public: | 27 public: |
| 28 using OnConnectedCallback = | 28 using OnConnectedCallback = |
| 29 base::Callback<void(std::unique_ptr<HostPairingController>)>; | 29 base::Callback<void(std::unique_ptr<HostPairingController>)>; |
| 30 | 30 |
| 31 SharkConnectionListener( | 31 SharkConnectionListener( |
| 32 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner, | 32 const scoped_refptr<base::TaskRunner>& input_service_task_runner, |
|
fdoray
2017/06/20 12:42:39
Pass by value instead of by const reference and st
xiyuan
2017/06/20 15:26:55
Done.
| |
| 33 OnConnectedCallback callback); | 33 OnConnectedCallback callback); |
| 34 ~SharkConnectionListener() override; | 34 ~SharkConnectionListener() override; |
| 35 | 35 |
| 36 void ResetController(); | 36 void ResetController(); |
| 37 | 37 |
| 38 // This function is used for testing. | 38 // This function is used for testing. |
| 39 BluetoothHostPairingController* GetControllerForTesting(); | 39 BluetoothHostPairingController* GetControllerForTesting(); |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 typedef HostPairingController::Stage Stage; | 42 typedef HostPairingController::Stage Stage; |
| 43 | 43 |
| 44 // HostPairingController::Observer overrides: | 44 // HostPairingController::Observer overrides: |
| 45 void PairingStageChanged(Stage new_stage) override; | 45 void PairingStageChanged(Stage new_stage) override; |
| 46 | 46 |
| 47 OnConnectedCallback callback_; | 47 OnConnectedCallback callback_; |
| 48 std::unique_ptr<HostPairingController> controller_; | 48 std::unique_ptr<HostPairingController> controller_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(SharkConnectionListener); | 50 DISALLOW_COPY_AND_ASSIGN(SharkConnectionListener); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace pairing_chromeos | 53 } // namespace pairing_chromeos |
| 54 | 54 |
| 55 #endif // COMPONENTS_PAIRING_SHARK_CONNECTION_LISTENER_H_ | 55 #endif // COMPONENTS_PAIRING_SHARK_CONNECTION_LISTENER_H_ |
| OLD | NEW |