Chromium Code Reviews| 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 7fd80f93a3d7b10662e499dca4addbd1c23ed0b6..1239b84bb39a0f547a3161fdaf21c4851052e593 100644 |
| --- a/content/browser/bluetooth/bluetooth_allowed_devices_map.cc |
| +++ b/content/browser/bluetooth/bluetooth_allowed_devices_map.cc |
| @@ -18,6 +18,15 @@ using device::BluetoothUUID; |
| namespace content { |
| +namespace { |
| + |
| +std::ostream& operator<<(std::ostream& out, |
| + const WebBluetoothDeviceId& device_id) { |
| + return out << device_id.str(); |
| +} |
| + |
| +} // namespace |
| + |
| BluetoothAllowedDevicesMap::BluetoothAllowedDevicesMap() {} |
| BluetoothAllowedDevicesMap::~BluetoothAllowedDevicesMap() {} |
| @@ -167,12 +176,14 @@ void BluetoothAllowedDevicesMap::AddUnionOfServicesTo( |
| std::unordered_set<BluetoothUUID, device::BluetoothUUIDHash>* |
| unionOfServices) { |
| for (const auto& filter : options->filters) { |
| - for (const base::Optional<BluetoothUUID>& uuid : filter->services) { |
| - unionOfServices->insert(uuid.value()); |
| + if (filter->services) { |
|
ortuno
2016/11/21 04:42:31
All this nesting makes the code less readable. I w
juncai
2016/11/21 21:27:05
Added test for this.
Done.
|
| + for (const BluetoothUUID& uuid : filter->services.value()) { |
| + unionOfServices->insert(uuid); |
| + } |
| } |
| } |
| - for (const base::Optional<BluetoothUUID>& uuid : options->optional_services) { |
| - unionOfServices->insert(uuid.value()); |
| + for (const BluetoothUUID& uuid : options->optional_services) { |
| + unionOfServices->insert(uuid); |
| } |
| } |