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

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

Issue 2015463004: bluetooth: Use BluetoothUUID instead of string when sending uuids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-mojo-request-device
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/bluetooth_type_converters.cc
diff --git a/content/renderer/bluetooth/bluetooth_type_converters.cc b/content/renderer/bluetooth/bluetooth_type_converters.cc
index 863e2ef859d6eb10ca430e5e8cc3580b40a83317..db21fd8a69976698b1b8b4bb6334f2eee1ae9c46 100644
--- a/content/renderer/bluetooth/bluetooth_type_converters.cc
+++ b/content/renderer/bluetooth/bluetooth_type_converters.cc
@@ -16,8 +16,10 @@ blink::mojom::WebBluetoothScanFilterPtr TypeConverter<
web_filter) {
blink::mojom::WebBluetoothScanFilterPtr filter =
blink::mojom::WebBluetoothScanFilter::New();
+
if (!web_filter.services.isEmpty())
- filter->services = Array<String>::From(web_filter.services);
+ filter->services = Array<std::unique_ptr<device::BluetoothUUID>>::From(
+ web_filter.services);
if (web_filter.hasName)
filter->name = String::From(web_filter.name);
@@ -27,6 +29,7 @@ blink::mojom::WebBluetoothScanFilterPtr TypeConverter<
return filter;
}
+// static
blink::mojom::WebBluetoothRequestDeviceOptionsPtr
TypeConverter<blink::mojom::WebBluetoothRequestDeviceOptionsPtr,
blink::WebRequestDeviceOptions>::
@@ -37,8 +40,16 @@ TypeConverter<blink::mojom::WebBluetoothRequestDeviceOptionsPtr,
options->filters = mojo::Array<blink::mojom::WebBluetoothScanFilterPtr>::From(
web_options.filters);
options->optional_services =
- mojo::Array<mojo::String>::From(web_options.optionalServices);
+ mojo::Array<std::unique_ptr<device::BluetoothUUID>>::From(
+ web_options.optionalServices);
return options;
}
+// static
+std::unique_ptr<device::BluetoothUUID>
+TypeConverter<std::unique_ptr<device::BluetoothUUID>,
+ blink::WebString>::Convert(const blink::WebString& web_string) {
+ return base::WrapUnique(new device::BluetoothUUID(web_string.utf8()));
Jeffrey Yasskin 2016/05/28 04:38:06 Shouldn't the TypeConverter kill the connection if
ortuno 2016/05/31 17:30:47 The type converter doesn't know anything about the
Jeffrey Yasskin 2016/05/31 21:52:57 And I guess since this is the renderer side anyway
ortuno 2016/06/01 15:37:58 Done.
+}
+
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698