Index: content/child/bluetooth/bluetooth_dispatcher.cc |
diff --git a/content/child/bluetooth/bluetooth_dispatcher.cc b/content/child/bluetooth/bluetooth_dispatcher.cc |
index 41a28a9ee2738d1b042b7b4a1618df7bdc6e297a..47754246e1d7daa3ecf46b6bb3b709172333c8d3 100644 |
--- a/content/child/bluetooth/bluetooth_dispatcher.cc |
+++ b/content/child/bluetooth/bluetooth_dispatcher.cc |
@@ -18,6 +18,7 @@ using blink::WebBluetoothDevice; |
using blink::WebBluetoothError; |
using blink::WebBluetoothRequestDeviceCallbacks; |
using blink::WebString; |
+using blink::WebVector; |
namespace content { |
@@ -45,6 +46,20 @@ WebBluetoothError::ErrorType WebBluetoothErrorFromBluetoothError( |
return WebBluetoothError::NotFoundError; |
} |
+WebBluetoothDevice::VendorIDSource GetWebVendorIdSource( |
+ device::BluetoothDevice::VendorIDSource vendor_id_source) { |
+ switch (vendor_id_source) { |
+ case device::BluetoothDevice::VENDOR_ID_UNKNOWN: |
+ return WebBluetoothDevice::VendorIDSource::Unknown; |
+ case device::BluetoothDevice::VENDOR_ID_BLUETOOTH: |
+ return WebBluetoothDevice::VendorIDSource::Bluetooth; |
+ case device::BluetoothDevice::VENDOR_ID_USB: |
+ return WebBluetoothDevice::VendorIDSource::USB; |
+ } |
+ NOTREACHED(); |
+ return WebBluetoothDevice::VendorIDSource::Unknown; |
+} |
+ |
} // namespace |
BluetoothDispatcher::BluetoothDispatcher(ThreadSafeSender* sender) |
@@ -104,11 +119,19 @@ void BluetoothDispatcher::OnWorkerRunLoopStopped() { |
void BluetoothDispatcher::OnRequestDeviceSuccess( |
int thread_id, |
int request_id, |
- const std::string& device_instance_id) { |
+ const BluetoothDevice& device) { |
DCHECK(pending_requests_.Lookup(request_id)) << request_id; |
+ |
+ WebVector<WebString> uuids(device.uuids.size()); |
+ for (size_t i = 0; i < device.uuids.size(); ++i) |
+ uuids[i] = WebString::fromUTF8(device.uuids[i].c_str()); |
+ |
pending_requests_.Lookup(request_id) |
- ->onSuccess( |
- new WebBluetoothDevice(WebString::fromUTF8(device_instance_id))); |
+ ->onSuccess(new WebBluetoothDevice( |
+ WebString::fromUTF8(device.instance_id), WebString(device.name), |
+ device.device_class, GetWebVendorIdSource(device.vendor_id_source), |
+ device.vendor_id, device.product_id, device.product_version, |
+ device.paired, device.connected, uuids)); |
pending_requests_.Remove(request_id); |
} |