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

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

Issue 1991063002: Implement the gattserverdisconnected event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rename-web-bluetooth-device
Patch Set: 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/web_bluetooth_impl.h
diff --git a/content/renderer/bluetooth/web_bluetooth_impl.h b/content/renderer/bluetooth/web_bluetooth_impl.h
index 193b76bf25dc8a7a34e3ac5fa5411c309d4b6d3c..fae4ad485ee28a85710b1c6266d444a54161a059 100644
--- a/content/renderer/bluetooth/web_bluetooth_impl.h
+++ b/content/renderer/bluetooth/web_bluetooth_impl.h
@@ -48,6 +48,7 @@ class CONTENT_EXPORT WebBluetoothImpl
blink::WebBluetoothRequestDeviceCallbacks* callbacks) override;
void connect(
const blink::WebString& device_id,
+ blink::WebBluetoothDevice* device,
blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) override;
void disconnect(const blink::WebString& device_id) override;
void getPrimaryService(
@@ -83,6 +84,7 @@ class CONTENT_EXPORT WebBluetoothImpl
void RemoteCharacteristicValueChanged(
const mojo::String& characteristic_instance_id,
mojo::Array<uint8_t> value) override;
+ void GattServerDisconnected(const mojo::String& device_id) override;
// Callbacks for WebBluetoothService calls:
void OnConnectComplete(
@@ -131,6 +133,12 @@ class CONTENT_EXPORT WebBluetoothImpl
std::unordered_map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*>
active_characteristics_;
+ // Map of device_ids to WebBluetoothDevices. Added in connect() and removed in
+ // disconnect(). This means a device may not actually be connected while in
+ // this map, but that it will definitely be removed when the page navigates.
+ std::unordered_map<std::string, blink::WebBluetoothDevice*>
+ connected_devices_;
+
// Binding associated with |web_bluetooth_service_|.
mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_;

Powered by Google App Engine
This is Rietveld 408576698