Index: content/browser/bluetooth/bluetooth_allowed_devices_map.cc |
diff --git a/content/browser/bluetooth/bluetooth_allowed_devices_map.cc b/content/browser/bluetooth/bluetooth_allowed_devices_map.cc |
index c959c8715ac0de11529a2987b2c9f41189a998b3..375458d870b9087874dcfe06ac1dad8538336e23 100644 |
--- a/content/browser/bluetooth/bluetooth_allowed_devices_map.cc |
+++ b/content/browser/bluetooth/bluetooth_allowed_devices_map.cc |
@@ -55,9 +55,18 @@ const std::string& BluetoothAllowedDevicesMap::AddDevice( |
// https://w3c.github.io/webappsec-secure-contexts/ |
CHECK(!origin.unique()); |
- if (ContainsKey(origin_to_device_address_to_id_map_[origin], |
- device_address)) { |
+ auto device_address_to_id_map = origin_to_device_address_to_id_map_[origin]; |
+ auto id_iter = device_address_to_id_map.find(device_address); |
+ if (id_iter != device_address_to_id_map.end()) { |
VLOG(1) << "Device already in map of allowed devices."; |
+ const auto& device_id = id_iter->second; |
+ |
+ // Update set of services. |
+ auto new_services = UnionOfServices(filters, optional_services); |
Jeffrey Yasskin
2016/02/03 23:18:18
We could optimize this by having UnionOfServices a
ortuno
2016/02/04 02:21:09
Done. Also replaced the UnionOfServices function s
Jeffrey Yasskin
2016/02/04 04:03:40
Yep, that's what I meant. Thanks!
|
+ auto& old_services = |
+ origin_to_device_id_to_services_map_[origin][device_id]; |
+ old_services.insert(new_services.begin(), new_services.end()); |
+ |
return origin_to_device_address_to_id_map_[origin][device_address]; |
} |
const std::string device_id = GenerateDeviceId(); |