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

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

Issue 1922923002: bluetooth: Move requestDevice to mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-separate-tests-request-device
Patch Set: Change ref to pointer 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
new file mode 100644
index 0000000000000000000000000000000000000000..863e2ef859d6eb10ca430e5e8cc3580b40a83317
--- /dev/null
+++ b/content/renderer/bluetooth/bluetooth_type_converters.cc
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/bluetooth/bluetooth_type_converters.h"
+
+#include "content/child/mojo/type_converters.h"
+#include "third_party/WebKit/public/platform/modules/bluetooth/WebRequestDeviceOptions.h"
+
+namespace mojo {
+
+// static
+blink::mojom::WebBluetoothScanFilterPtr TypeConverter<
+ blink::mojom::WebBluetoothScanFilterPtr,
+ blink::WebBluetoothScanFilter>::Convert(const blink::WebBluetoothScanFilter&
+ web_filter) {
+ blink::mojom::WebBluetoothScanFilterPtr filter =
+ blink::mojom::WebBluetoothScanFilter::New();
+ if (!web_filter.services.isEmpty())
+ filter->services = Array<String>::From(web_filter.services);
+
+ if (web_filter.hasName)
+ filter->name = String::From(web_filter.name);
+
+ if (!web_filter.namePrefix.isEmpty())
+ filter->name_prefix = String::From(web_filter.namePrefix);
+ return filter;
+}
+
+blink::mojom::WebBluetoothRequestDeviceOptionsPtr
+TypeConverter<blink::mojom::WebBluetoothRequestDeviceOptionsPtr,
+ blink::WebRequestDeviceOptions>::
+ Convert(const blink::WebRequestDeviceOptions& web_options) {
+ blink::mojom::WebBluetoothRequestDeviceOptionsPtr options =
+ blink::mojom::WebBluetoothRequestDeviceOptions::New();
+
+ options->filters = mojo::Array<blink::mojom::WebBluetoothScanFilterPtr>::From(
+ web_options.filters);
+ options->optional_services =
+ mojo::Array<mojo::String>::From(web_options.optionalServices);
+ return options;
+}
+
+} // namespace mojo
« no previous file with comments | « content/renderer/bluetooth/bluetooth_type_converters.h ('k') | content/renderer/bluetooth/web_bluetooth_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698