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

Unified Diff: content/child/bluetooth/bluetooth_dispatcher.cc

Issue 1172853004: Chromium side of RequestDeviceOptions implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Add an end-namespace comment Created 5 years, 6 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
« no previous file with comments | « content/child/bluetooth/bluetooth_dispatcher.h ('k') | content/child/bluetooth/web_bluetooth_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/bluetooth/bluetooth_dispatcher.cc
diff --git a/content/child/bluetooth/bluetooth_dispatcher.cc b/content/child/bluetooth/bluetooth_dispatcher.cc
index a2d6fe25e3d5ebbd467e7f7c789a21c7d4336ed7..a9ad9903b04d130733f6c98e79dc966f252fed9c 100644
--- a/content/child/bluetooth/bluetooth_dispatcher.cc
+++ b/content/child/bluetooth/bluetooth_dispatcher.cc
@@ -10,11 +10,13 @@
#include "base/thread_task_runner_handle.h"
#include "content/child/thread_safe_sender.h"
#include "content/common/bluetooth/bluetooth_messages.h"
+#include "device/bluetooth/bluetooth_uuid.h"
#include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothDevice.h"
#include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothError.h"
#include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothGATTCharacteristic.h"
#include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothGATTRemoteServer.h"
#include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothGATTService.h"
+#include "third_party/WebKit/public/platform/modules/bluetooth/WebRequestDeviceOptions.h"
using blink::WebBluetoothConnectGATTCallbacks;
using blink::WebBluetoothDevice;
@@ -24,6 +26,8 @@ using blink::WebBluetoothGATTRemoteServer;
using blink::WebBluetoothGATTService;
using blink::WebBluetoothReadValueCallbacks;
using blink::WebBluetoothRequestDeviceCallbacks;
+using blink::WebBluetoothScanFilter;
+using blink::WebRequestDeviceOptions;
using blink::WebString;
using blink::WebVector;
@@ -165,9 +169,28 @@ void BluetoothDispatcher::OnMessageReceived(const IPC::Message& msg) {
}
void BluetoothDispatcher::requestDevice(
+ const WebRequestDeviceOptions& options,
blink::WebBluetoothRequestDeviceCallbacks* callbacks) {
int request_id = pending_requests_.Add(callbacks);
- Send(new BluetoothHostMsg_RequestDevice(CurrentWorkerId(), request_id));
+
+ // Convert |options| to its IPC form.
+ std::vector<content::BluetoothScanFilter> filters(options.filters.size());
+ for (size_t i = 0; i < options.filters.size(); ++i) {
+ const WebBluetoothScanFilter& web_filter = options.filters[i];
+ BluetoothScanFilter& filter = filters[i];
+ filter.services.reserve(web_filter.services.size());
+ for (const WebString& service : web_filter.services) {
+ filter.services.push_back(device::BluetoothUUID(service.utf8()));
+ }
+ }
+ std::vector<device::BluetoothUUID> optional_services;
+ optional_services.reserve(options.optionalServices.size());
+ for (const WebString& optional_service : options.optionalServices) {
+ optional_services.push_back(device::BluetoothUUID(optional_service.utf8()));
+ }
+
+ Send(new BluetoothHostMsg_RequestDevice(CurrentWorkerId(), request_id,
+ filters, optional_services));
}
void BluetoothDispatcher::connectGATT(
« no previous file with comments | « content/child/bluetooth/bluetooth_dispatcher.h ('k') | content/child/bluetooth/web_bluetooth_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698