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 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 closesocket(socket_fd); | 214 closesocket(socket_fd); |
215 return; | 215 return; |
216 } | 216 } |
217 | 217 |
218 // Note: We don't have a meaningful |IPEndPoint|, but that is ok since the | 218 // Note: We don't have a meaningful |IPEndPoint|, but that is ok since the |
219 // TCPSocket implementation does not actually require one. | 219 // TCPSocket implementation does not actually require one. |
220 int net_result = | 220 int net_result = |
221 scoped_socket->AdoptConnectedSocket(socket_fd, net::IPEndPoint()); | 221 scoped_socket->AdoptConnectedSocket(socket_fd, net::IPEndPoint()); |
222 if (net_result != net::OK) { | 222 if (net_result != net::OK) { |
223 error_callback.Run("Error connecting to socket: " + | 223 error_callback.Run("Error connecting to socket: " + |
224 std::string(net::ErrorToString(net_result))); | 224 net::ErrorToString(net_result)); |
225 closesocket(socket_fd); | 225 closesocket(socket_fd); |
226 return; | 226 return; |
227 } | 227 } |
228 | 228 |
229 SetTCPSocket(scoped_socket.Pass()); | 229 SetTCPSocket(scoped_socket.Pass()); |
230 success_callback.Run(); | 230 success_callback.Run(); |
231 } | 231 } |
232 | 232 |
233 void BluetoothSocketWin::DoListen( | 233 void BluetoothSocketWin::DoListen( |
234 const BluetoothUUID& uuid, | 234 const BluetoothUUID& uuid, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 return; | 387 return; |
388 } | 388 } |
389 | 389 |
390 scoped_refptr<BluetoothSocketWin> peer_socket = | 390 scoped_refptr<BluetoothSocketWin> peer_socket = |
391 CreateBluetoothSocket(ui_task_runner(), socket_thread()); | 391 CreateBluetoothSocket(ui_task_runner(), socket_thread()); |
392 peer_socket->SetTCPSocket(accept_socket.Pass()); | 392 peer_socket->SetTCPSocket(accept_socket.Pass()); |
393 success_callback.Run(peer_device, peer_socket); | 393 success_callback.Run(peer_device, peer_socket); |
394 } | 394 } |
395 | 395 |
396 } // namespace device | 396 } // namespace device |
OLD | NEW |