Index: content/browser/bluetooth/frame_connected_bluetooth_devices.h |
diff --git a/content/browser/bluetooth/frame_connected_bluetooth_devices.h b/content/browser/bluetooth/frame_connected_bluetooth_devices.h |
index bf76e55763527d7cfcfbeaf7f0c6957cbf80c2e6..b5b3d891d7d6658143fa88eb5fa105a9ec6fbe80 100644 |
--- a/content/browser/bluetooth/frame_connected_bluetooth_devices.h |
+++ b/content/browser/bluetooth/frame_connected_bluetooth_devices.h |
@@ -9,6 +9,8 @@ |
#include <string> |
#include <unordered_map> |
+#include "base/optional.h" |
+#include "components/web_bluetooth/web_bluetooth_device_id.h" |
#include "content/common/content_export.h" |
#include "url/origin.h" |
@@ -35,23 +37,25 @@ class CONTENT_EXPORT FrameConnectedBluetoothDevices final { |
~FrameConnectedBluetoothDevices(); |
// Returns true if the map holds a connection to |device_id|. |
- bool IsConnectedToDeviceWithId(const std::string& device_id); |
+ bool IsConnectedToDeviceWithId( |
+ const web_bluetooth::WebBluetoothDeviceId& device_id); |
// If a connection doesn't exist already for |device_id|, adds a connection to |
// the map and increases the WebContents count of connected devices. |
- void Insert(const std::string& device_id, |
+ void Insert(const web_bluetooth::WebBluetoothDeviceId& device_id, |
std::unique_ptr<device::BluetoothGattConnection> connection); |
// Deletes the BluetoothGattConnection for |device_id| and decrements the |
// WebContents count of connected devices if |device_id| had a connection. |
- void CloseConnectionToDeviceWithId(const std::string& device_id); |
+ void CloseConnectionToDeviceWithId( |
+ const web_bluetooth::WebBluetoothDeviceId& device_id); |
// Deletes the BluetoothGattConnection for |device_address| and decrements the |
// WebContents count of connected devices if |device_address| had a |
// connection. Returns the device_id of the device associated with the |
// connection. |
- std::string CloseConnectionToDeviceWithAddress( |
- const std::string& device_address); |
+ base::Optional<web_bluetooth::WebBluetoothDeviceId> |
+ CloseConnectionToDeviceWithAddress(const std::string& device_address); |
private: |
// Increments the Connected Devices count of the frame's WebContents. |
@@ -64,12 +68,14 @@ class CONTENT_EXPORT FrameConnectedBluetoothDevices final { |
// Keeps the BluetoothGattConnection objects alive so that connections don't |
// get closed. |
- std::unordered_map<std::string, |
- std::unique_ptr<device::BluetoothGattConnection>> |
+ std::unordered_map<web_bluetooth::WebBluetoothDeviceId, |
+ std::unique_ptr<device::BluetoothGattConnection>, |
+ web_bluetooth::WebBluetoothDeviceIdHash> |
device_id_to_connection_map_; |
// Keeps track of which device addresses correspond to which ids. |
- std::unordered_map<std::string, std::string> device_address_to_id_map_; |
+ std::unordered_map<std::string, web_bluetooth::WebBluetoothDeviceId> |
+ device_address_to_id_map_; |
DISALLOW_COPY_AND_ASSIGN(FrameConnectedBluetoothDevices); |
}; |