OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
13 #include "device/bluetooth/bluetooth_socket.h" | 13 #include "device/bluetooth/bluetooth_socket.h" |
14 | 14 |
15 namespace dbus { | 15 namespace dbus { |
16 | |
17 class FileDescriptor; | 16 class FileDescriptor; |
18 | |
19 } // namespace dbus | 17 } // namespace dbus |
20 | 18 |
21 namespace net { | 19 namespace net { |
22 | 20 class IOBuffer; |
23 class DrainableIOBuffer; | |
24 class GrowableIOBuffer; | |
25 | |
26 } // namespace net | 21 } // namespace net |
27 | 22 |
28 namespace chromeos { | 23 namespace chromeos { |
29 | 24 |
30 // The BluetoothSocketChromeOS class implements BluetoothSocket for the | 25 // The BluetoothSocketChromeOS class implements BluetoothSocket for the |
31 // Chrome OS platform. | 26 // Chrome OS platform. |
32 class CHROMEOS_EXPORT BluetoothSocketChromeOS | 27 class CHROMEOS_EXPORT BluetoothSocketChromeOS |
33 : public device::BluetoothSocket { | 28 : public device::BluetoothSocket { |
34 public: | 29 public: |
35 // BluetoothSocket override. | 30 // BluetoothSocket override |
36 virtual bool Receive(net::GrowableIOBuffer* buffer) OVERRIDE; | 31 virtual void Disconnect(const base::Closure& callback) OVERRIDE; |
37 virtual bool Send(net::DrainableIOBuffer* buffer) OVERRIDE; | 32 virtual void Receive(int count, |
38 virtual std::string GetLastErrorMessage() const OVERRIDE; | 33 const ReceiveCompletionCallback& success_callback, |
| 34 const ReceiveErrorCompletionCallback& error_callback) |
| 35 OVERRIDE; |
| 36 virtual void Send(scoped_refptr<net::IOBuffer> buffer, |
| 37 int buffer_size, |
| 38 const SendCompletionCallback& success_callback, |
| 39 const ErrorCompletionCallback& error_callback) OVERRIDE; |
39 | 40 |
40 // Create an instance of a BluetoothSocket from the passed file descriptor | 41 // Create an instance of a BluetoothSocket from the passed file descriptor |
41 // received over D-Bus in |fd|, the descriptor will be taken from that object | 42 // received over D-Bus in |fd|, the descriptor will be taken from that object |
42 // and ownership passed to the returned object. | 43 // and ownership passed to the returned object. |
43 static scoped_refptr<device::BluetoothSocket> Create( | 44 static scoped_refptr<device::BluetoothSocket> Create( |
44 dbus::FileDescriptor* fd); | 45 dbus::FileDescriptor* fd); |
45 | 46 |
46 protected: | 47 protected: |
47 virtual ~BluetoothSocketChromeOS(); | 48 virtual ~BluetoothSocketChromeOS(); |
48 | 49 |
(...skipping 15 matching lines...) Expand all Loading... |
64 // Last error message, set during Receive() and Send() and retrieved using | 65 // Last error message, set during Receive() and Send() and retrieved using |
65 // GetLastErrorMessage(). | 66 // GetLastErrorMessage(). |
66 std::string error_message_; | 67 std::string error_message_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketChromeOS); | 69 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketChromeOS); |
69 }; | 70 }; |
70 | 71 |
71 } // namespace chromeos | 72 } // namespace chromeos |
72 | 73 |
73 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ | 74 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ |
OLD | NEW |