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_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_H |
6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_H | 6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_H |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "components/proximity_auth/connection.h" | 13 #include "components/proximity_auth/connection.h" |
14 #include "device/bluetooth/bluetooth_adapter.h" | 14 #include "device/bluetooth/bluetooth_adapter.h" |
15 #include "device/bluetooth/bluetooth_device.h" | 15 #include "device/bluetooth/bluetooth_device.h" |
16 #include "device/bluetooth/bluetooth_socket.h" | 16 #include "device/bluetooth/bluetooth_socket.h" |
17 #include "device/bluetooth/bluetooth_uuid.h" | 17 #include "device/bluetooth/bluetooth_uuid.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 class IOBuffer; | 20 class IOBuffer; |
21 } | 21 } |
22 | 22 |
| 23 namespace cryptauth { |
| 24 struct RemoteDevice; |
| 25 } |
| 26 |
23 namespace proximity_auth { | 27 namespace proximity_auth { |
24 | 28 |
25 struct RemoteDevice; | |
26 | |
27 // Represents a Bluetooth connection with a remote device. The connection is a | 29 // Represents a Bluetooth connection with a remote device. The connection is a |
28 // persistent bidirectional channel for sending and receiving wire messages. | 30 // persistent bidirectional channel for sending and receiving wire messages. |
29 class BluetoothConnection : public Connection, | 31 class BluetoothConnection : public Connection, |
30 public device::BluetoothAdapter::Observer { | 32 public device::BluetoothAdapter::Observer { |
31 public: | 33 public: |
32 // Constructs a Bluetooth connection to the service with |uuid| on the | 34 // Constructs a Bluetooth connection to the service with |uuid| on the |
33 // |remote_device|. The |remote_device| must already be known to the system | 35 // |remote_device|. The |remote_device| must already be known to the system |
34 // Bluetooth daemon. | 36 // Bluetooth daemon. |
35 BluetoothConnection(const RemoteDevice& remote_device, | 37 BluetoothConnection(const cryptauth::RemoteDevice& remote_device, |
36 const device::BluetoothUUID& uuid); | 38 const device::BluetoothUUID& uuid); |
37 ~BluetoothConnection() override; | 39 ~BluetoothConnection() override; |
38 | 40 |
39 // Connection: | 41 // Connection: |
40 void Connect() override; | 42 void Connect() override; |
41 void Disconnect() override; | 43 void Disconnect() override; |
42 | 44 |
43 protected: | 45 protected: |
44 // Connection: | 46 // Connection: |
45 void SendMessageImpl(std::unique_ptr<WireMessage> message) override; | 47 void SendMessageImpl(std::unique_ptr<WireMessage> message) override; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 std::unique_ptr<WireMessage> pending_message_; | 83 std::unique_ptr<WireMessage> pending_message_; |
82 | 84 |
83 base::WeakPtrFactory<BluetoothConnection> weak_ptr_factory_; | 85 base::WeakPtrFactory<BluetoothConnection> weak_ptr_factory_; |
84 | 86 |
85 DISALLOW_COPY_AND_ASSIGN(BluetoothConnection); | 87 DISALLOW_COPY_AND_ASSIGN(BluetoothConnection); |
86 }; | 88 }; |
87 | 89 |
88 } // namespace proximity_auth | 90 } // namespace proximity_auth |
89 | 91 |
90 #endif // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_H | 92 #endif // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_H |
OLD | NEW |