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 { |
| 16 class SingleThreadTaskRunner; |
| 17 } |
| 18 |
15 namespace pairing_chromeos { | 19 namespace pairing_chromeos { |
16 | 20 |
17 // Listens for incoming connection from shark controller. If connection | 21 // Listens for incoming connection from shark controller. If connection |
18 // is established, invokes callback passing HostPairingController | 22 // is established, invokes callback passing HostPairingController |
19 // as an argument. | 23 // as an argument. |
20 class SharkConnectionListener : public HostPairingController::Observer { | 24 class SharkConnectionListener : public HostPairingController::Observer { |
21 public: | 25 public: |
22 using OnConnectedCallback = | 26 using OnConnectedCallback = |
23 base::Callback<void(std::unique_ptr<HostPairingController>)>; | 27 base::Callback<void(std::unique_ptr<HostPairingController>)>; |
24 | 28 |
25 explicit SharkConnectionListener(OnConnectedCallback callback); | 29 SharkConnectionListener( |
| 30 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner, |
| 31 OnConnectedCallback callback); |
26 ~SharkConnectionListener() override; | 32 ~SharkConnectionListener() override; |
27 | 33 |
28 private: | 34 private: |
29 typedef HostPairingController::Stage Stage; | 35 typedef HostPairingController::Stage Stage; |
30 | 36 |
31 // HostPairingController::Observer overrides: | 37 // HostPairingController::Observer overrides: |
32 void PairingStageChanged(Stage new_stage) override; | 38 void PairingStageChanged(Stage new_stage) override; |
33 | 39 |
34 OnConnectedCallback callback_; | 40 OnConnectedCallback callback_; |
35 std::unique_ptr<HostPairingController> controller_; | 41 std::unique_ptr<HostPairingController> controller_; |
36 | 42 |
37 DISALLOW_COPY_AND_ASSIGN(SharkConnectionListener); | 43 DISALLOW_COPY_AND_ASSIGN(SharkConnectionListener); |
38 }; | 44 }; |
39 | 45 |
40 } // namespace pairing_chromeos | 46 } // namespace pairing_chromeos |
41 | 47 |
42 #endif // COMPONENTS_PAIRING_SHARK_CONNECTION_LISTENER_H_ | 48 #endif // COMPONENTS_PAIRING_SHARK_CONNECTION_LISTENER_H_ |
OLD | NEW |