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" |
24 #include "device/bluetooth/bluetooth_audio_sink_chromeos.h" | 25 #include "device/bluetooth/bluetooth_audio_sink_chromeos.h" |
25 #include "device/bluetooth/bluetooth_device.h" | 26 #include "device/bluetooth/bluetooth_device.h" |
26 #include "device/bluetooth/bluetooth_device_chromeos.h" | 27 #include "device/bluetooth/bluetooth_device_chromeos.h" |
27 #include "device/bluetooth/bluetooth_pairing_chromeos.h" | 28 #include "device/bluetooth/bluetooth_pairing_chromeos.h" |
28 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h" | 29 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h" |
29 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h" | 30 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h" |
30 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" | 31 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" |
31 #include "device/bluetooth/bluetooth_socket_chromeos.h" | 32 #include "device/bluetooth/bluetooth_socket_chromeos.h" |
32 #include "device/bluetooth/bluetooth_socket_thread.h" | 33 #include "device/bluetooth/bluetooth_socket_thread.h" |
33 #include "device/bluetooth/bluetooth_uuid.h" | 34 #include "device/bluetooth/bluetooth_uuid.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } | 306 } |
306 scoped_refptr<BluetoothAudioSinkChromeOS> audio_sink( | 307 scoped_refptr<BluetoothAudioSinkChromeOS> audio_sink( |
307 new BluetoothAudioSinkChromeOS(this)); | 308 new BluetoothAudioSinkChromeOS(this)); |
308 audio_sink->Register( | 309 audio_sink->Register( |
309 options, base::Bind(&BluetoothAdapterChromeOS::OnRegisterAudioSink, | 310 options, base::Bind(&BluetoothAdapterChromeOS::OnRegisterAudioSink, |
310 weak_ptr_factory_.GetWeakPtr(), callback, | 311 weak_ptr_factory_.GetWeakPtr(), callback, |
311 error_callback, audio_sink), | 312 error_callback, audio_sink), |
312 error_callback); | 313 error_callback); |
313 } | 314 } |
314 | 315 |
| 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 |
315 void BluetoothAdapterChromeOS::RemovePairingDelegateInternal( | 325 void BluetoothAdapterChromeOS::RemovePairingDelegateInternal( |
316 BluetoothDevice::PairingDelegate* pairing_delegate) { | 326 BluetoothDevice::PairingDelegate* pairing_delegate) { |
317 // Before removing a pairing delegate make sure that there aren't any devices | 327 // Before removing a pairing delegate make sure that there aren't any devices |
318 // currently using it; if there are, clear the pairing context which will | 328 // currently using it; if there are, clear the pairing context which will |
319 // make any responses no-ops. | 329 // make any responses no-ops. |
320 for (DevicesMap::iterator iter = devices_.begin(); | 330 for (DevicesMap::iterator iter = devices_.begin(); |
321 iter != devices_.end(); ++iter) { | 331 iter != devices_.end(); ++iter) { |
322 BluetoothDeviceChromeOS* device_chromeos = | 332 BluetoothDeviceChromeOS* device_chromeos = |
323 static_cast<BluetoothDeviceChromeOS*>(iter->second); | 333 static_cast<BluetoothDeviceChromeOS*>(iter->second); |
324 | 334 |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 | 1413 |
1404 // If the queued request resulted in a pending call, then let it | 1414 // If the queued request resulted in a pending call, then let it |
1405 // asynchonously process the remaining queued requests once the pending | 1415 // asynchonously process the remaining queued requests once the pending |
1406 // call returns. | 1416 // call returns. |
1407 if (discovery_request_pending_) | 1417 if (discovery_request_pending_) |
1408 return; | 1418 return; |
1409 } | 1419 } |
1410 } | 1420 } |
1411 | 1421 |
1412 } // namespace chromeos | 1422 } // namespace chromeos |
OLD | NEW |