Chromium Code Reviews| Index: content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| index e203b43fb2b1c44b52770ee4da48e9fff90eb18e..a31c731077c8b9cffd79d673c3fab062fa2c0f15 100644 |
| --- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| +++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| @@ -49,6 +49,8 @@ enum class UMARequestDeviceOutcome { |
| DISCOVERY_START_FAILED = 3, |
| DISCOVERY_STOP_FAILED = 4, |
| NO_MATCHING_DEVICES_FOUND = 5, |
| + BLUETOOTH_ADAPTER_NOT_PRESENT = 6, |
| + BLUETOOTH_ADAPTER_OFF = 7, |
| // NOTE: Add new requestDevice() outcomes immediately above this line. Make |
| // sure to update the enum list in |
| // tools/metrics/histogram/histograms.xml accordingly. |
| @@ -296,6 +298,22 @@ void BluetoothDispatcherHost::OnRequestDevice( |
| bad_message::ReceivedBadMessage( |
| this, bad_message::BDH_DUPLICATE_REQUEST_DEVICE_ID); |
| } |
| + if (!adapter_->IsPresent()) { |
| + VLOG(1) << "Bluetooth Adapter not present. Can't serve requestDevice."; |
| + RecordRequestDeviceOutcome( |
| + UMARequestDeviceOutcome::BLUETOOTH_ADAPTER_NOT_PRESENT); |
| + Send(new BluetoothMsg_RequestDeviceError( |
|
Jeffrey Yasskin
2015/08/05 17:13:14
Every Send needs to be matched to a request_device
ortuno
2015/08/05 18:01:53
Done.
|
| + thread_id, request_id, WebBluetoothError::NoBluetoothAdapter)); |
| + return; |
| + } |
| + if (!adapter_->IsPowered()) { |
|
Jeffrey Yasskin
2015/08/05 17:13:13
This one isn't going to happen once we have the re
ortuno
2015/08/05 18:01:53
True. But the dialog is gonna take a couple of rel
|
| + VLOG(1) << "Bluetooth Adapter is not powered. Can't serve requestDevice."; |
| + RecordRequestDeviceOutcome( |
| + UMARequestDeviceOutcome::BLUETOOTH_ADAPTER_OFF); |
| + Send(new BluetoothMsg_RequestDeviceError( |
| + thread_id, request_id, WebBluetoothError::BluetoothAdapterOff)); |
| + return; |
| + } |
| adapter_->StartDiscoverySessionWithFilter( |
| ComputeScanFilter(filters), |
| base::Bind(&BluetoothDispatcherHost::OnDiscoverySessionStarted, |