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

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

Issue 2015463004: bluetooth: Use BluetoothUUID instead of string when sending uuids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-mojo-request-device
Patch Set: Fix merge conflict Created 4 years, 6 months 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 1f9b2cfd755cc00b7b5685266369e9a2b4940b5d..1e8f79b115a6f415c6e463504eb09461137a851b 100644
--- a/content/browser/bluetooth/bluetooth_allowed_devices_map.cc
+++ b/content/browser/bluetooth/bluetooth_allowed_devices_map.cc
@@ -8,6 +8,7 @@
#include "base/base64.h"
#include "base/logging.h"
+#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "content/browser/bluetooth/bluetooth_blacklist.h"
@@ -129,8 +130,8 @@ const std::string& BluetoothAllowedDevicesMap::GetDeviceAddress(
bool BluetoothAllowedDevicesMap::IsOriginAllowedToAccessService(
const url::Origin& origin,
const std::string& device_id,
- const std::string& service_uuid) const {
- if (BluetoothBlacklist::Get().IsExcluded(BluetoothUUID(service_uuid))) {
+ const BluetoothUUID& service_uuid) const {
+ if (BluetoothBlacklist::Get().IsExcluded(service_uuid)) {
return false;
}
@@ -159,14 +160,15 @@ std::string BluetoothAllowedDevicesMap::GenerateDeviceId() {
void BluetoothAllowedDevicesMap::AddUnionOfServicesTo(
const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options,
- std::set<std::string>* unionOfServices) {
+ std::unordered_set<BluetoothUUID, device::BluetoothUUIDHash>*
+ unionOfServices) {
for (const auto& filter : options->filters) {
- for (const std::string& uuid : filter->services) {
- unionOfServices->insert(uuid);
+ for (const base::Optional<BluetoothUUID>& uuid : filter->services) {
+ unionOfServices->insert(uuid.value());
}
}
- for (const std::string& uuid : options->optional_services) {
- unionOfServices->insert(uuid);
+ for (const base::Optional<BluetoothUUID>& uuid : options->optional_services) {
+ unionOfServices->insert(uuid.value());
}
}

Powered by Google App Engine
This is Rietveld 408576698