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_device_win.h" | 5 #include "device/bluetooth/bluetooth_device_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "device/bluetooth/bluetooth_profile_win.h" | |
15 #include "device/bluetooth/bluetooth_service_record_win.h" | 14 #include "device/bluetooth/bluetooth_service_record_win.h" |
16 #include "device/bluetooth/bluetooth_socket_thread.h" | 15 #include "device/bluetooth/bluetooth_socket_thread.h" |
17 #include "device/bluetooth/bluetooth_socket_win.h" | 16 #include "device/bluetooth/bluetooth_socket_win.h" |
18 #include "device/bluetooth/bluetooth_task_manager_win.h" | 17 #include "device/bluetooth/bluetooth_task_manager_win.h" |
19 #include "device/bluetooth/bluetooth_uuid.h" | 18 #include "device/bluetooth/bluetooth_uuid.h" |
20 | 19 |
21 namespace { | 20 namespace { |
22 | 21 |
23 const int kSdpBytesBufferSize = 1024; | 22 const int kSdpBytesBufferSize = 1024; |
24 | 23 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 195 |
197 void BluetoothDeviceWin::Forget(const ErrorCallback& error_callback) { | 196 void BluetoothDeviceWin::Forget(const ErrorCallback& error_callback) { |
198 NOTIMPLEMENTED(); | 197 NOTIMPLEMENTED(); |
199 } | 198 } |
200 | 199 |
201 void BluetoothDeviceWin::ConnectToProfile( | 200 void BluetoothDeviceWin::ConnectToProfile( |
202 device::BluetoothProfile* profile, | 201 device::BluetoothProfile* profile, |
203 const base::Closure& callback, | 202 const base::Closure& callback, |
204 const ConnectToProfileErrorCallback& error_callback) { | 203 const ConnectToProfileErrorCallback& error_callback) { |
205 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); | 204 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); |
206 static_cast<BluetoothProfileWin*>(profile)->Connect(this, | 205 error_callback.Run("Removed. Use chrome.bluetoothSocket.connect() instead."); |
207 ui_task_runner_, | |
208 socket_thread_, | |
209 net_log_, | |
210 net_log_source_, | |
211 callback, | |
212 error_callback); | |
213 } | 206 } |
214 | 207 |
215 void BluetoothDeviceWin::ConnectToService( | 208 void BluetoothDeviceWin::ConnectToService( |
216 const BluetoothUUID& uuid, | 209 const BluetoothUUID& uuid, |
217 const ConnectToServiceCallback& callback, | 210 const ConnectToServiceCallback& callback, |
218 const ConnectToServiceErrorCallback& error_callback) { | 211 const ConnectToServiceErrorCallback& error_callback) { |
219 // TODO(keybuk): implement | 212 scoped_refptr<BluetoothSocketWin> socket( |
220 NOTIMPLEMENTED(); | 213 BluetoothSocketWin::CreateBluetoothSocket( |
| 214 ui_task_runner_, socket_thread_, NULL, net::NetLog::Source())); |
| 215 socket->Connect(this, uuid, base::Bind(callback, socket), error_callback); |
221 } | 216 } |
222 | 217 |
223 void BluetoothDeviceWin::StartConnectionMonitor( | 218 void BluetoothDeviceWin::StartConnectionMonitor( |
224 const base::Closure& callback, | 219 const base::Closure& callback, |
225 const ErrorCallback& error_callback) { | 220 const ErrorCallback& error_callback) { |
226 NOTIMPLEMENTED(); | 221 NOTIMPLEMENTED(); |
227 } | 222 } |
228 | 223 |
229 const BluetoothServiceRecord* BluetoothDeviceWin::GetServiceRecord( | 224 const BluetoothServiceRecord* BluetoothDeviceWin::GetServiceRecord( |
230 const device::BluetoothUUID& uuid) const { | 225 const device::BluetoothUUID& uuid) const { |
231 for (ServiceRecordList::const_iterator iter = service_record_list_.begin(); | 226 for (ServiceRecordList::const_iterator iter = service_record_list_.begin(); |
232 iter != service_record_list_.end(); | 227 iter != service_record_list_.end(); |
233 ++iter) { | 228 ++iter) { |
234 if ((*iter)->uuid() == uuid) | 229 if ((*iter)->uuid() == uuid) |
235 return *iter; | 230 return *iter; |
236 } | 231 } |
237 return NULL; | 232 return NULL; |
238 } | 233 } |
239 | 234 |
240 } // namespace device | 235 } // namespace device |
OLD | NEW |