Index: device/bluetooth/bluetooth_socket_win.h |
diff --git a/device/bluetooth/bluetooth_socket_win.h b/device/bluetooth/bluetooth_socket_win.h |
index 94f3df213edca7a4adfe30cfa2e782ccd94b3136..c997a1f0000651e1d4f2606ea1f071528bd20945 100644 |
--- a/device/bluetooth/bluetooth_socket_win.h |
+++ b/device/bluetooth/bluetooth_socket_win.h |
@@ -15,6 +15,7 @@ |
#include "base/threading/thread_checker.h" |
#include "device/bluetooth/bluetooth_service_record_win.h" |
#include "device/bluetooth/bluetooth_socket.h" |
+#include "net/base/ip_endpoint.h" |
#include "net/base/net_log.h" |
#include "net/socket/tcp_socket.h" |
@@ -41,7 +42,13 @@ class BluetoothSocketWin : public BluetoothSocket { |
net::NetLog* net_log, |
const net::NetLog::Source& source); |
- // Connect to the peer device and calls |success_callback| when the |
+ static scoped_refptr<BluetoothSocketWin> CreateBluetoothSocket( |
+ scoped_ptr<net::TCPSocket> existing, |
+ scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
+ scoped_refptr<BluetoothSocketThreadWin> socket_thread, |
+ net::NetLog* net_log, |
+ const net::NetLog::Source& source); |
keybuk
2014/04/16 08:06:17
It seems that the BluetoothProfileWin implementati
xiyuan
2014/04/23 17:42:55
Done.
|
+ |
// connection has been established successfully. If an error occurs, calls |
// |error_callback| with a system error message. |
void Connect(const base::Closure& success_callback, |
@@ -61,6 +68,10 @@ class BluetoothSocketWin : public BluetoothSocket { |
const SendCompletionCallback& success_callback, |
const ErrorCompletionCallback& error_callback) OVERRIDE; |
+ typedef base::Callback<void(scoped_refptr<BluetoothSocketWin>, |
+ const net::IPEndPoint&)> OnAcceptCallback; |
+ void Accept(const OnAcceptCallback& on_accept_callback); |
+ |
protected: |
virtual ~BluetoothSocketWin(); |
@@ -111,6 +122,11 @@ class BluetoothSocketWin : public BluetoothSocket { |
const ReceiveErrorCompletionCallback& error_callback, |
int send_result); |
+ void DoAccept(); |
+ void OnAcceptOnSocketThread(int accept_result); |
+ void OnAcceptOnUI(scoped_ptr<net::TCPSocket> accept_socket, |
+ const net::IPEndPoint& peer_address); |
+ |
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
scoped_refptr<BluetoothSocketThreadWin> socket_thread_; |
net::NetLog* net_log_; |
@@ -125,6 +141,10 @@ class BluetoothSocketWin : public BluetoothSocket { |
std::queue<linked_ptr<WriteRequest> > write_queue_; |
scoped_refptr<net::IOBufferWithSize> read_buffer_; |
+ scoped_ptr<net::TCPSocket> accept_socket_; |
+ net::IPEndPoint accept_address_; |
+ OnAcceptCallback on_accept_callback_; |
+ |
DISALLOW_COPY_AND_ASSIGN(BluetoothSocketWin); |
}; |