Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1174)

Unified Diff: device/bluetooth/bluetooth_socket_chromeos.h

Issue 267633003: Reimplement BluetoothSocketChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_socket_chromeos.h
diff --git a/device/bluetooth/bluetooth_socket_chromeos.h b/device/bluetooth/bluetooth_socket_chromeos.h
index 58141b8f0e4e14a0800b096dc63de82d95c6e9b5..8301d5c62df3d4a17c9a17ca74ad681c763dcdbc 100644
--- a/device/bluetooth/bluetooth_socket_chromeos.h
+++ b/device/bluetooth/bluetooth_socket_chromeos.h
@@ -5,67 +5,46 @@
#ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_
#define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
#include "chromeos/chromeos_export.h"
#include "device/bluetooth/bluetooth_socket.h"
+#include "device/bluetooth/bluetooth_socket_net.h"
namespace dbus {
class FileDescriptor;
} // namespace dbus
-namespace net {
-class IOBuffer;
-} // namespace net
namespace chromeos {
// The BluetoothSocketChromeOS class implements BluetoothSocket for the
// Chrome OS platform.
class CHROMEOS_EXPORT BluetoothSocketChromeOS
- : public device::BluetoothSocket {
+ : public device::BluetoothSocketNet {
public:
- // Overriden from BluetoothSocket:
- virtual void Close() OVERRIDE;
- virtual void Disconnect(const base::Closure& callback) OVERRIDE;
- virtual void Receive(int buffer_size,
- const ReceiveCompletionCallback& success_callback,
- const ReceiveErrorCompletionCallback& error_callback)
- OVERRIDE;
- virtual void Send(scoped_refptr<net::IOBuffer> buffer,
- int buffer_size,
- const SendCompletionCallback& success_callback,
- const ErrorCompletionCallback& error_callback) OVERRIDE;
+ static scoped_refptr<BluetoothSocketChromeOS> CreateBluetoothSocket(
+ scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
+ scoped_refptr<device::BluetoothSocketThread> socket_thread,
+ net::NetLog* net_log,
+ const net::NetLog::Source& source);
- // Create an instance of a BluetoothSocket from the passed file descriptor
- // received over D-Bus in |fd|, the descriptor will be taken from that object
- // and ownership passed to the returned object.
- static scoped_refptr<device::BluetoothSocket> Create(
- dbus::FileDescriptor* fd);
+ virtual void Connect(scoped_ptr<dbus::FileDescriptor> fd,
+ const base::Closure& success_callback,
+ const ErrorCompletionCallback& error_callback);
protected:
virtual ~BluetoothSocketChromeOS();
private:
- BluetoothSocketChromeOS(int fd);
-
- // The different socket types have different reading patterns; l2cap sockets
- // have to be read with boundaries between datagrams preserved while rfcomm
- // sockets do not.
- enum SocketType {
- L2CAP,
- RFCOMM
- };
+ BluetoothSocketChromeOS(
+ scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
+ scoped_refptr<device::BluetoothSocketThread> socket_thread,
+ net::NetLog* net_log,
+ const net::NetLog::Source& source);
- // File descriptor and socket type of the socket.
- const int fd_;
- SocketType socket_type_;
+ void DoConnect(scoped_ptr<dbus::FileDescriptor> fd,
+ const base::Closure& success_callback,
+ const ErrorCompletionCallback& error_callback);
- // Last error message, set during Receive() and Send() and retrieved using
- // GetLastErrorMessage().
- std::string error_message_;
DISALLOW_COPY_AND_ASSIGN(BluetoothSocketChromeOS);
};

Powered by Google App Engine
This is Rietveld 408576698