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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 CSADDR_INFO address_info; | 68 CSADDR_INFO address_info; |
69 GUID uuid; | 69 GUID uuid; |
70 base::string16 name; | 70 base::string16 name; |
71 WSAQUERYSET service; | 71 WSAQUERYSET service; |
72 }; | 72 }; |
73 | 73 |
74 // static | 74 // static |
75 scoped_refptr<BluetoothSocketWin> | 75 scoped_refptr<BluetoothSocketWin> |
76 BluetoothSocketWin::CreateBluetoothSocket( | 76 BluetoothSocketWin::CreateBluetoothSocket( |
77 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 77 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
78 scoped_refptr<device::BluetoothSocketThread> socket_thread, | 78 scoped_refptr<device::BluetoothSocketThread> socket_thread) { |
79 net::NetLog* net_log, | |
80 const net::NetLog::Source& source) { | |
81 DCHECK(ui_task_runner->RunsTasksOnCurrentThread()); | 79 DCHECK(ui_task_runner->RunsTasksOnCurrentThread()); |
82 | 80 |
83 return make_scoped_refptr( | 81 return make_scoped_refptr( |
84 new BluetoothSocketWin(ui_task_runner, socket_thread, net_log, source)); | 82 new BluetoothSocketWin(ui_task_runner, socket_thread)); |
85 } | 83 } |
86 | 84 |
87 BluetoothSocketWin::BluetoothSocketWin( | 85 BluetoothSocketWin::BluetoothSocketWin( |
88 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 86 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
89 scoped_refptr<BluetoothSocketThread> socket_thread, | 87 scoped_refptr<BluetoothSocketThread> socket_thread) |
90 net::NetLog* net_log, | 88 : BluetoothSocketNet(ui_task_runner, socket_thread), |
91 const net::NetLog::Source& source) | |
92 : BluetoothSocketNet(ui_task_runner, socket_thread, net_log, source), | |
93 supports_rfcomm_(false), | 89 supports_rfcomm_(false), |
94 rfcomm_channel_(0xFF), | 90 rfcomm_channel_(0xFF), |
95 bth_addr_(BTH_ADDR_NULL) { | 91 bth_addr_(BTH_ADDR_NULL) { |
96 } | 92 } |
97 | 93 |
98 BluetoothSocketWin::~BluetoothSocketWin() { | 94 BluetoothSocketWin::~BluetoothSocketWin() { |
99 } | 95 } |
100 | 96 |
101 void BluetoothSocketWin::Connect( | 97 void BluetoothSocketWin::Connect( |
102 const BluetoothDeviceWin* device, | 98 const BluetoothDeviceWin* device, |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 const std::string peer_device_address = | 378 const std::string peer_device_address = |
383 IPEndPointToBluetoothAddress(peer_address); | 379 IPEndPointToBluetoothAddress(peer_address); |
384 const BluetoothDevice* peer_device = adapter_->GetDevice(peer_device_address); | 380 const BluetoothDevice* peer_device = adapter_->GetDevice(peer_device_address); |
385 if (!peer_device) { | 381 if (!peer_device) { |
386 LOG(WARNING) << "OnAccept failed with unknown device, addr=" | 382 LOG(WARNING) << "OnAccept failed with unknown device, addr=" |
387 << peer_device_address; | 383 << peer_device_address; |
388 error_callback.Run(kFailedToAccept); | 384 error_callback.Run(kFailedToAccept); |
389 return; | 385 return; |
390 } | 386 } |
391 | 387 |
392 scoped_refptr<BluetoothSocketWin> peer_socket = CreateBluetoothSocket( | 388 scoped_refptr<BluetoothSocketWin> peer_socket = |
393 ui_task_runner(), | 389 CreateBluetoothSocket(ui_task_runner(), socket_thread()); |
394 socket_thread(), | |
395 net_log(), | |
396 source()); | |
397 peer_socket->SetTCPSocket(accept_socket.Pass()); | 390 peer_socket->SetTCPSocket(accept_socket.Pass()); |
398 success_callback.Run(peer_device, peer_socket); | 391 success_callback.Run(peer_device, peer_socket); |
399 } | 392 } |
400 | 393 |
401 } // namespace device | 394 } // namespace device |
OLD | NEW |