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

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

Issue 1902153003: bluetooth: Move connect/disconnect to mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-separate-connection-tests
Patch Set: Fix gypi Created 4 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/renderer/bluetooth/web_bluetooth_impl.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1f1615ffdd2ce1984c3dc3ba6f4b3c24938c3c1f..7e7230d8b33f92846adbda413c0d505b8898518f 100644
--- a/content/renderer/bluetooth/web_bluetooth_impl.cc
+++ b/content/renderer/bluetooth/web_bluetooth_impl.cc
@@ -41,11 +41,15 @@ void WebBluetoothImpl::requestDevice(
void WebBluetoothImpl::connect(
const blink::WebString& device_id,
blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) {
- GetDispatcher()->connect(frame_routing_id_, device_id, callbacks);
+ GetWebBluetoothService().RemoteServerConnect(
+ mojo::String::From(device_id),
+ base::Bind(&WebBluetoothImpl::OnConnectComplete, base::Unretained(this),
+ base::Passed(base::WrapUnique(callbacks))));
}
void WebBluetoothImpl::disconnect(const blink::WebString& device_id) {
- GetDispatcher()->disconnect(frame_routing_id_, device_id);
+ GetWebBluetoothService().RemoteServerDisconnect(
+ mojo::String::From(device_id));
}
void WebBluetoothImpl::getPrimaryService(
@@ -142,6 +146,17 @@ void WebBluetoothImpl::RemoteCharacteristicValueChanged(
value.PassStorage()));
}
+void WebBluetoothImpl::OnConnectComplete(
+ std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks>
+ callbacks,
+ blink::mojom::WebBluetoothError error) {
+ if (error == blink::mojom::WebBluetoothError::SUCCESS) {
+ callbacks->onSuccess();
+ } else {
+ callbacks->onError(error);
+ }
+}
+
void WebBluetoothImpl::OnGetPrimaryServiceComplete(
const blink::WebString& device_id,
std::unique_ptr<blink::WebBluetoothGetPrimaryServiceCallbacks> callbacks,
« no previous file with comments | « content/renderer/bluetooth/web_bluetooth_impl.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698