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