OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" | 5 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 device_id = WebBluetoothDeviceId::Create(); | 160 device_id = WebBluetoothDeviceId::Create(); |
161 } | 161 } |
162 return device_id; | 162 return device_id; |
163 } | 163 } |
164 | 164 |
165 void BluetoothAllowedDevicesMap::AddUnionOfServicesTo( | 165 void BluetoothAllowedDevicesMap::AddUnionOfServicesTo( |
166 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options, | 166 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options, |
167 std::unordered_set<BluetoothUUID, device::BluetoothUUIDHash>* | 167 std::unordered_set<BluetoothUUID, device::BluetoothUUIDHash>* |
168 unionOfServices) { | 168 unionOfServices) { |
169 for (const auto& filter : options->filters) { | 169 for (const auto& filter : options->filters) { |
170 for (const base::Optional<BluetoothUUID>& uuid : filter->services) { | 170 if (!filter->services) { |
171 unionOfServices->insert(uuid.value()); | 171 continue; |
| 172 } |
| 173 |
| 174 for (const BluetoothUUID& uuid : filter->services.value()) { |
| 175 unionOfServices->insert(uuid); |
172 } | 176 } |
173 } | 177 } |
174 for (const base::Optional<BluetoothUUID>& uuid : options->optional_services) { | 178 for (const BluetoothUUID& uuid : options->optional_services) { |
175 unionOfServices->insert(uuid.value()); | 179 unionOfServices->insert(uuid); |
176 } | 180 } |
177 } | 181 } |
178 | 182 |
179 } // namespace content | 183 } // namespace content |
OLD | NEW |