| Index: content/browser/bluetooth/frame_connected_bluetooth_devices.cc
|
| diff --git a/content/browser/bluetooth/frame_connected_bluetooth_devices.cc b/content/browser/bluetooth/frame_connected_bluetooth_devices.cc
|
| index 164579237b6effafeca34e8bc7e1296ca12b4133..7187609453ccdabce09be39b060ad456eceadbfe 100644
|
| --- a/content/browser/bluetooth/frame_connected_bluetooth_devices.cc
|
| +++ b/content/browser/bluetooth/frame_connected_bluetooth_devices.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "content/browser/bluetooth/frame_connected_bluetooth_devices.h"
|
|
|
| +#include "base/optional.h"
|
| #include "base/strings/string_util.h"
|
| #include "content/browser/web_contents/web_contents_impl.h"
|
| #include "content/public/browser/web_contents.h"
|
| @@ -23,7 +24,7 @@ FrameConnectedBluetoothDevices::~FrameConnectedBluetoothDevices() {
|
| }
|
|
|
| bool FrameConnectedBluetoothDevices::IsConnectedToDeviceWithId(
|
| - const std::string& device_id) {
|
| + const WebBluetoothDeviceId& device_id) {
|
| auto connection_iter = device_id_to_connection_map_.find(device_id);
|
| if (connection_iter == device_id_to_connection_map_.end()) {
|
| return false;
|
| @@ -39,7 +40,7 @@ bool FrameConnectedBluetoothDevices::IsConnectedToDeviceWithId(
|
| }
|
|
|
| void FrameConnectedBluetoothDevices::Insert(
|
| - const std::string& device_id,
|
| + const WebBluetoothDeviceId& device_id,
|
| std::unique_ptr<device::BluetoothGattConnection> connection) {
|
| auto connection_iter = device_id_to_connection_map_.find(device_id);
|
| if (connection_iter != device_id_to_connection_map_.end()) {
|
| @@ -74,7 +75,7 @@ void FrameConnectedBluetoothDevices::Insert(
|
| }
|
|
|
| void FrameConnectedBluetoothDevices::CloseConnectionToDeviceWithId(
|
| - const std::string& device_id) {
|
| + const WebBluetoothDeviceId& device_id) {
|
| auto connection_iter = device_id_to_connection_map_.find(device_id);
|
| if (connection_iter == device_id_to_connection_map_.end()) {
|
| return;
|
| @@ -85,17 +86,18 @@ void FrameConnectedBluetoothDevices::CloseConnectionToDeviceWithId(
|
| DecrementDevicesConnectedCount();
|
| }
|
|
|
| -std::string FrameConnectedBluetoothDevices::CloseConnectionToDeviceWithAddress(
|
| +base::Optional<WebBluetoothDeviceId>
|
| +FrameConnectedBluetoothDevices::CloseConnectionToDeviceWithAddress(
|
| const std::string& device_address) {
|
| auto device_address_iter = device_address_to_id_map_.find(device_address);
|
| if (device_address_iter == device_address_to_id_map_.end()) {
|
| - return std::string();
|
| + return base::nullopt;
|
| }
|
| - std::string device_id = device_address_iter->second;
|
| + WebBluetoothDeviceId device_id = device_address_iter->second;
|
| CHECK(device_address_to_id_map_.erase(device_address));
|
| CHECK(device_id_to_connection_map_.erase(device_id));
|
| DecrementDevicesConnectedCount();
|
| - return device_id;
|
| + return base::make_optional(device_id);
|
| }
|
|
|
| void FrameConnectedBluetoothDevices::IncrementDevicesConnectedCount() {
|
|
|