| 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..4168059d2f92b9a008f3fc0877e815d20a3b9c72 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 "content/common/bluetooth/web_bluetooth_device_id.h"
|
| #include "content/common/content_export.h"
|
| #include "url/origin.h"
|
|
|
| @@ -35,22 +37,22 @@ 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 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 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 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(
|
| + base::Optional<WebBluetoothDeviceId> CloseConnectionToDeviceWithAddress(
|
| const std::string& device_address);
|
|
|
| private:
|
| @@ -64,12 +66,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<WebBluetoothDeviceId,
|
| + std::unique_ptr<device::BluetoothGattConnection>,
|
| + 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, WebBluetoothDeviceId>
|
| + device_address_to_id_map_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(FrameConnectedBluetoothDevices);
|
| };
|
|
|