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_adapter_chromeos.h" | 5 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
16 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
17 #include "chromeos/dbus/bluetooth_adapter_client.h" | 17 #include "chromeos/dbus/bluetooth_adapter_client.h" |
18 #include "chromeos/dbus/bluetooth_agent_manager_client.h" | 18 #include "chromeos/dbus/bluetooth_agent_manager_client.h" |
19 #include "chromeos/dbus/bluetooth_agent_service_provider.h" | 19 #include "chromeos/dbus/bluetooth_agent_service_provider.h" |
20 #include "chromeos/dbus/bluetooth_device_client.h" | 20 #include "chromeos/dbus/bluetooth_device_client.h" |
21 #include "chromeos/dbus/bluetooth_input_client.h" | 21 #include "chromeos/dbus/bluetooth_input_client.h" |
22 #include "chromeos/dbus/dbus_thread_manager.h" | 22 #include "chromeos/dbus/dbus_thread_manager.h" |
23 #include "device/bluetooth/bluetooth_adapter_profile_chromeos.h" | 23 #include "device/bluetooth/bluetooth_adapter_profile_chromeos.h" |
24 #include "device/bluetooth/bluetooth_advertisement_chromeos.h" | |
25 #include "device/bluetooth/bluetooth_audio_sink_chromeos.h" | 24 #include "device/bluetooth/bluetooth_audio_sink_chromeos.h" |
26 #include "device/bluetooth/bluetooth_device.h" | 25 #include "device/bluetooth/bluetooth_device.h" |
27 #include "device/bluetooth/bluetooth_device_chromeos.h" | 26 #include "device/bluetooth/bluetooth_device_chromeos.h" |
28 #include "device/bluetooth/bluetooth_pairing_chromeos.h" | 27 #include "device/bluetooth/bluetooth_pairing_chromeos.h" |
29 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h" | 28 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h" |
30 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h" | 29 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h" |
31 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" | 30 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" |
32 #include "device/bluetooth/bluetooth_socket_chromeos.h" | 31 #include "device/bluetooth/bluetooth_socket_chromeos.h" |
33 #include "device/bluetooth/bluetooth_socket_thread.h" | 32 #include "device/bluetooth/bluetooth_socket_thread.h" |
34 #include "device/bluetooth/bluetooth_uuid.h" | 33 #include "device/bluetooth/bluetooth_uuid.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 305 } |
307 scoped_refptr<BluetoothAudioSinkChromeOS> audio_sink( | 306 scoped_refptr<BluetoothAudioSinkChromeOS> audio_sink( |
308 new BluetoothAudioSinkChromeOS(this)); | 307 new BluetoothAudioSinkChromeOS(this)); |
309 audio_sink->Register( | 308 audio_sink->Register( |
310 options, base::Bind(&BluetoothAdapterChromeOS::OnRegisterAudioSink, | 309 options, base::Bind(&BluetoothAdapterChromeOS::OnRegisterAudioSink, |
311 weak_ptr_factory_.GetWeakPtr(), callback, | 310 weak_ptr_factory_.GetWeakPtr(), callback, |
312 error_callback, audio_sink), | 311 error_callback, audio_sink), |
313 error_callback); | 312 error_callback); |
314 } | 313 } |
315 | 314 |
316 void BluetoothAdapterChromeOS::RegisterAdvertisement( | |
317 scoped_ptr<device::BluetoothAdvertisement::Data> advertisement_data, | |
318 const CreateAdvertisementCallback& callback, | |
319 const CreateAdvertisementErrorCallback& error_callback) { | |
320 scoped_refptr<BluetoothAdvertisementChromeOS> advertisement( | |
321 new BluetoothAdvertisementChromeOS(advertisement_data.Pass(), this)); | |
322 advertisement->Register(base::Bind(callback, advertisement), error_callback); | |
323 } | |
324 | |
325 void BluetoothAdapterChromeOS::RemovePairingDelegateInternal( | 315 void BluetoothAdapterChromeOS::RemovePairingDelegateInternal( |
326 BluetoothDevice::PairingDelegate* pairing_delegate) { | 316 BluetoothDevice::PairingDelegate* pairing_delegate) { |
327 // Before removing a pairing delegate make sure that there aren't any devices | 317 // Before removing a pairing delegate make sure that there aren't any devices |
328 // currently using it; if there are, clear the pairing context which will | 318 // currently using it; if there are, clear the pairing context which will |
329 // make any responses no-ops. | 319 // make any responses no-ops. |
330 for (DevicesMap::iterator iter = devices_.begin(); | 320 for (DevicesMap::iterator iter = devices_.begin(); |
331 iter != devices_.end(); ++iter) { | 321 iter != devices_.end(); ++iter) { |
332 BluetoothDeviceChromeOS* device_chromeos = | 322 BluetoothDeviceChromeOS* device_chromeos = |
333 static_cast<BluetoothDeviceChromeOS*>(iter->second); | 323 static_cast<BluetoothDeviceChromeOS*>(iter->second); |
334 | 324 |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 | 1403 |
1414 // If the queued request resulted in a pending call, then let it | 1404 // If the queued request resulted in a pending call, then let it |
1415 // asynchonously process the remaining queued requests once the pending | 1405 // asynchonously process the remaining queued requests once the pending |
1416 // call returns. | 1406 // call returns. |
1417 if (discovery_request_pending_) | 1407 if (discovery_request_pending_) |
1418 return; | 1408 return; |
1419 } | 1409 } |
1420 } | 1410 } |
1421 | 1411 |
1422 } // namespace chromeos | 1412 } // namespace chromeos |
OLD | NEW |