OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_profile_win.h" | 5 #include "device/bluetooth/bluetooth_profile_win.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "device/bluetooth/bluetooth_adapter_factory.h" | 12 #include "device/bluetooth/bluetooth_adapter_factory.h" |
13 #include "device/bluetooth/bluetooth_adapter_win.h" | 13 #include "device/bluetooth/bluetooth_adapter_win.h" |
14 #include "device/bluetooth/bluetooth_device_win.h" | 14 #include "device/bluetooth/bluetooth_device_win.h" |
15 #include "device/bluetooth/bluetooth_service_record.h" | 15 #include "device/bluetooth/bluetooth_service_record.h" |
16 #include "device/bluetooth/bluetooth_socket_thread_win.h" | 16 #include "device/bluetooth/bluetooth_socket_thread.h" |
17 #include "device/bluetooth/bluetooth_socket_win.h" | 17 #include "device/bluetooth/bluetooth_socket_win.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 using device::BluetoothAdapter; | 21 using device::BluetoothAdapter; |
22 using device::BluetoothDevice; | 22 using device::BluetoothDevice; |
23 using device::BluetoothProfileWin; | 23 using device::BluetoothProfileWin; |
24 using device::BluetoothSocket; | 24 using device::BluetoothSocket; |
25 using device::BluetoothSocketWin; | 25 using device::BluetoothSocketWin; |
26 | 26 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 BluetoothAdapterFactory::GetAdapter( | 113 BluetoothAdapterFactory::GetAdapter( |
114 base::Bind(&BluetoothProfileWin::OnGetAdapter, | 114 base::Bind(&BluetoothProfileWin::OnGetAdapter, |
115 weak_ptr_factory_.GetWeakPtr(), | 115 weak_ptr_factory_.GetWeakPtr(), |
116 callback)); | 116 callback)); |
117 } | 117 } |
118 | 118 |
119 void BluetoothProfileWin::Connect( | 119 void BluetoothProfileWin::Connect( |
120 const BluetoothDeviceWin* device, | 120 const BluetoothDeviceWin* device, |
121 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 121 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
122 scoped_refptr<BluetoothSocketThreadWin> socket_thread, | 122 scoped_refptr<BluetoothSocketThread> socket_thread, |
123 net::NetLog* net_log, | 123 net::NetLog* net_log, |
124 const net::NetLog::Source& source, | 124 const net::NetLog::Source& source, |
125 const base::Closure& success_callback, | 125 const base::Closure& success_callback, |
126 const ErrorCallback& error_callback) { | 126 const ErrorCallback& error_callback) { |
127 DCHECK(ui_task_runner->RunsTasksOnCurrentThread()); | 127 DCHECK(ui_task_runner->RunsTasksOnCurrentThread()); |
128 if (connection_callback_.is_null()) { | 128 if (connection_callback_.is_null()) { |
129 error_callback.Run(kNoConnectionCallback); | 129 error_callback.Run(kNoConnectionCallback); |
130 return; | 130 return; |
131 } | 131 } |
132 | 132 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 connection_callback_.Run(device, connected); | 214 connection_callback_.Run(device, connected); |
215 } | 215 } |
216 | 216 |
217 BluetoothAdapterWin* BluetoothProfileWin::adapter() const { | 217 BluetoothAdapterWin* BluetoothProfileWin::adapter() const { |
218 DCHECK(adapter_); | 218 DCHECK(adapter_); |
219 return static_cast<BluetoothAdapterWin*>(adapter_.get()); | 219 return static_cast<BluetoothAdapterWin*>(adapter_.get()); |
220 } | 220 } |
221 | 221 |
222 } // namespace device | 222 } // namespace device |
OLD | NEW |