Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Unified Diff: content/browser/bluetooth/bluetooth_allowed_devices_map.cc

Issue 2506813003: Use new wrapper types for web_bluetooth.mojom (Closed)
Patch Set: updated web_bluetooth_impl.cc Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
}

Powered by Google App Engine
This is Rietveld 408576698