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

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

Issue 1082273006: bluetooth: Impl uses new WebBluetoothGATTRemoteServer content/browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes based on comments Created 5 years, 8 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 fb1cec8ba73ccd03d2ba023a51eaf5dadc188cba..059b1ea5a7abc6deabae28fb8b51b2ffe15d1053 100644
--- a/content/child/bluetooth/bluetooth_dispatcher.cc
+++ b/content/child/bluetooth/bluetooth_dispatcher.cc
@@ -12,9 +12,12 @@
#include "content/common/bluetooth/bluetooth_messages.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/WebBluetoothGATTRemoteServer.h"
+using blink::WebBluetoothConnectGATTCallbacks;
using blink::WebBluetoothDevice;
using blink::WebBluetoothError;
+using blink::WebBluetoothGATTRemoteServer;
using blink::WebBluetoothRequestDeviceCallbacks;
using blink::WebString;
using blink::WebVector;
@@ -95,6 +98,7 @@ void BluetoothDispatcher::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(BluetoothMsg_RequestDeviceSuccess,
OnRequestDeviceSuccess);
IPC_MESSAGE_HANDLER(BluetoothMsg_RequestDeviceError, OnRequestDeviceError);
+ IPC_MESSAGE_HANDLER(BluetoothMsg_ConnectGATTSuccess, OnConnectGATTSuccess);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
DCHECK(handled) << "Unhandled message:" << msg.type();
@@ -106,6 +110,14 @@ void BluetoothDispatcher::requestDevice(
Send(new BluetoothHostMsg_RequestDevice(CurrentWorkerId(), request_id));
}
+void BluetoothDispatcher::connectGATT(
+ const blink::WebString& device_instance_id,
+ blink::WebBluetoothConnectGATTCallbacks* callbacks) {
+ int request_id = pending_connect_requests_.Add(callbacks);
+ Send(new BluetoothHostMsg_ConnectGATT(CurrentWorkerId(), request_id,
+ device_instance_id.utf8()));
+}
+
void BluetoothDispatcher::SetBluetoothMockDataSetForTesting(
const std::string& name) {
Send(new BluetoothHostMsg_SetBluetoothMockDataSetForTesting(name));
@@ -134,6 +146,17 @@ void BluetoothDispatcher::OnRequestDeviceSuccess(
pending_requests_.Remove(request_id);
}
+void BluetoothDispatcher::OnConnectGATTSuccess(
+ int thread_id,
+ int request_id,
+ const std::string& device_instance_id) {
+ DCHECK(pending_connect_requests_.Lookup(request_id)) << request_id;
+ pending_connect_requests_.Lookup(request_id)
+ ->onSuccess(new WebBluetoothGATTRemoteServer(
+ WebString::fromUTF8(device_instance_id), true /* connected */));
+ pending_connect_requests_.Remove(request_id);
+}
+
void BluetoothDispatcher::OnRequestDeviceError(int thread_id,
int request_id,
BluetoothError error_type) {
« 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