OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "device/bluetooth/bluetooth_socket_win.h" | 5 #include "device/bluetooth/bluetooth_socket_win.h" |
6 | 6 |
7 #include <objbase.h> | 7 #include <objbase.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
18 #include "device/bluetooth/bluetooth_device_win.h" | 18 #include "device/bluetooth/bluetooth_device_win.h" |
19 #include "device/bluetooth/bluetooth_init_win.h" | 19 #include "device/bluetooth/bluetooth_init_win.h" |
20 #include "device/bluetooth/bluetooth_service_record_win.h" | 20 #include "device/bluetooth/bluetooth_service_record_win.h" |
21 #include "device/bluetooth/bluetooth_socket_thread.h" | 21 #include "device/bluetooth/bluetooth_socket_thread.h" |
22 #include "net/base/io_buffer.h" | 22 #include "net/base/io_buffer.h" |
23 #include "net/base/ip_endpoint.h" | 23 #include "net/base/ip_endpoint.h" |
24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
| 25 #include "net/base/net_util.h" |
25 #include "net/base/winsock_init.h" | 26 #include "net/base/winsock_init.h" |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
29 const char kL2CAPNotSupported[] = "Bluetooth L2CAP protocal is not supported"; | 30 const char kL2CAPNotSupported[] = "Bluetooth L2CAP protocal is not supported"; |
30 const char kSocketAlreadyConnected[] = "Socket is already connected."; | 31 const char kSocketAlreadyConnected[] = "Socket is already connected."; |
31 const char kInvalidRfcommPort[] = "Invalid RFCCOMM port."; | 32 const char kInvalidRfcommPort[] = "Invalid RFCCOMM port."; |
32 const char kFailedToCreateSocket[] = "Failed to create socket."; | 33 const char kFailedToCreateSocket[] = "Failed to create socket."; |
33 const char kFailedToBindSocket[] = "Failed to bind socket."; | 34 const char kFailedToBindSocket[] = "Failed to bind socket."; |
34 const char kFailedToListenOnSocket[] = "Failed to listen on socket."; | 35 const char kFailedToListenOnSocket[] = "Failed to listen on socket."; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 return; | 388 return; |
388 } | 389 } |
389 | 390 |
390 scoped_refptr<BluetoothSocketWin> peer_socket = | 391 scoped_refptr<BluetoothSocketWin> peer_socket = |
391 CreateBluetoothSocket(ui_task_runner(), socket_thread()); | 392 CreateBluetoothSocket(ui_task_runner(), socket_thread()); |
392 peer_socket->SetTCPSocket(accept_socket.Pass()); | 393 peer_socket->SetTCPSocket(accept_socket.Pass()); |
393 success_callback.Run(peer_device, peer_socket); | 394 success_callback.Run(peer_device, peer_socket); |
394 } | 395 } |
395 | 396 |
396 } // namespace device | 397 } // namespace device |
OLD | NEW |