Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: content/renderer/bluetooth/web_bluetooth_impl.cc

Issue 2019853002: bluetooth: Use WebBluetoothDeviceId instead of string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-uuid-typemap
Patch Set: Lint Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 9b981b9c0b06d4b1d20c08038296c23180748aba..ef9ada01efaf948f6c5e5fb8ad839fbc4a686a9a 100644
--- a/content/renderer/bluetooth/web_bluetooth_impl.cc
+++ b/content/renderer/bluetooth/web_bluetooth_impl.cc
@@ -50,7 +50,7 @@ void WebBluetoothImpl::connect(
connected_devices_[device_id.utf8()] = device;
Jeffrey Yasskin 2016/06/03 17:22:05 Could you convert connected_devices_ to store Blue
ortuno 2016/06/06 22:23:00 Done.
GetWebBluetoothService().RemoteServerConnect(
- mojo::String::From(device_id),
+ BluetoothDeviceId(device_id.utf8()),
base::Bind(&WebBluetoothImpl::OnConnectComplete, base::Unretained(this),
base::Passed(base::WrapUnique(callbacks))));
}
@@ -59,7 +59,7 @@ void WebBluetoothImpl::disconnect(const blink::WebString& device_id) {
connected_devices_.erase(device_id.utf8());
GetWebBluetoothService().RemoteServerDisconnect(
- mojo::String::From(device_id));
+ BluetoothDeviceId(device_id.utf8()));
}
void WebBluetoothImpl::getPrimaryService(
@@ -67,7 +67,7 @@ void WebBluetoothImpl::getPrimaryService(
const blink::WebString& service_uuid,
blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks) {
GetWebBluetoothService().RemoteServerGetPrimaryService(
- mojo::String::From(device_id),
+ BluetoothDeviceId(device_id.utf8()),
base::make_optional(device::BluetoothUUID(service_uuid.utf8())),
base::Bind(&WebBluetoothImpl::OnGetPrimaryServiceComplete,
base::Unretained(this), device_id,
@@ -169,15 +169,16 @@ 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) {
- auto device_iter = connected_devices_.find(device_id);
+void WebBluetoothImpl::GattServerDisconnected(
+ const BluetoothDeviceId& device_id) {
+ auto device_iter = connected_devices_.find(device_id.str());
if (device_iter != connected_devices_.end()) {
device_iter->second->dispatchGattServerDisconnected();
connected_devices_.erase(device_iter);

Powered by Google App Engine
This is Rietveld 408576698