Index: content/renderer/bluetooth/web_bluetooth_impl.cc |
diff --git a/content/renderer/bluetooth/web_bluetooth_impl.cc b/content/renderer/bluetooth/web_bluetooth_impl.cc |
index f245362d2259568b00c0b5ff799a9a313eda4e2e..1b903306c9881fda35cd48d08306f4f980692086 100644 |
--- a/content/renderer/bluetooth/web_bluetooth_impl.cc |
+++ b/content/renderer/bluetooth/web_bluetooth_impl.cc |
@@ -23,6 +23,8 @@ |
#include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothRemoteGATTService.h" |
#include "third_party/WebKit/public/platform/modules/bluetooth/WebRequestDeviceOptions.h" |
+using web_bluetooth::WebBluetoothDeviceId; |
+ |
namespace content { |
WebBluetoothImpl::WebBluetoothImpl(shell::InterfaceProvider* remote_interfaces) |
@@ -47,29 +49,29 @@ void WebBluetoothImpl::connect( |
blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) { |
// TODO(crbug.com/495270): After the Bluetooth Tree is implemented, there will |
// only be one object per device. But for now we replace the previous object. |
- connected_devices_[device_id.utf8()] = device; |
+ WebBluetoothDeviceId device_id_obj = WebBluetoothDeviceId(device_id.utf8()); |
+ connected_devices_[device_id_obj] = device; |
GetWebBluetoothService().RemoteServerConnect( |
- mojo::String::From(device_id), |
+ std::move(device_id_obj), |
base::Bind(&WebBluetoothImpl::OnConnectComplete, base::Unretained(this), |
base::Passed(base::WrapUnique(callbacks)))); |
} |
void WebBluetoothImpl::disconnect(const blink::WebString& device_id) { |
- connected_devices_.erase(device_id.utf8()); |
+ WebBluetoothDeviceId device_id_obj = WebBluetoothDeviceId(device_id.utf8()); |
+ connected_devices_.erase(device_id_obj); |
- GetWebBluetoothService().RemoteServerDisconnect( |
- mojo::String::From(device_id)); |
+ GetWebBluetoothService().RemoteServerDisconnect(std::move(device_id_obj)); |
} |
void WebBluetoothImpl::getPrimaryServices( |
const blink::WebString& device_id, |
- |
blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
const blink::WebString& services_uuid, |
blink::WebBluetoothGetPrimaryServicesCallbacks* callbacks) { |
GetWebBluetoothService().RemoteServerGetPrimaryServices( |
- mojo::String::From(device_id), quantity, |
+ WebBluetoothDeviceId(device_id.utf8()), quantity, |
services_uuid.isEmpty() |
? base::nullopt |
: base::make_optional(device::BluetoothUUID(services_uuid.utf8())), |
@@ -173,14 +175,15 @@ void WebBluetoothImpl::OnRequestDeviceComplete( |
uuids[i] = blink::WebString::fromUTF8(device->uuids[i]); |
callbacks->onSuccess(base::WrapUnique(new blink::WebBluetoothDeviceInit( |
- blink::WebString::fromUTF8(device->id), |
+ blink::WebString::fromUTF8(device->id.str()), |
blink::WebString::fromUTF8(device->name), uuids))); |
} else { |
callbacks->onError(error); |
} |
} |
-void WebBluetoothImpl::GattServerDisconnected(const mojo::String& device_id) { |
+void WebBluetoothImpl::GattServerDisconnected( |
+ const WebBluetoothDeviceId& device_id) { |
auto device_iter = connected_devices_.find(device_id); |
if (device_iter != connected_devices_.end()) { |
// Remove device from the map before calling dispatchGattServerDisconnected |