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

Unified Diff: content/browser/bluetooth/bluetooth_blacklist.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_blacklist.cc
diff --git a/content/browser/bluetooth/bluetooth_blacklist.cc b/content/browser/bluetooth/bluetooth_blacklist.cc
index 44ecab449176b49eedc7dd66d35064deb5fe77d3..7508f12862490664cd93592be57497355447f099 100644
--- a/content/browser/bluetooth/bluetooth_blacklist.cc
+++ b/content/browser/bluetooth/bluetooth_blacklist.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
+#include "base/optional.h"
#include "base/strings/string_split.h"
#include "content/public/browser/content_browser_client.h"
@@ -32,7 +33,7 @@ BluetoothBlacklist& BluetoothBlacklist::Get() {
return g_singleton.Get();
}
-void BluetoothBlacklist::Add(const device::BluetoothUUID& uuid, Value value) {
+void BluetoothBlacklist::Add(const BluetoothUUID& uuid, Value value) {
CHECK(uuid.IsValid());
auto insert_result = blacklisted_uuids_.insert(std::make_pair(uuid, value));
bool inserted = insert_result.second;
@@ -87,8 +88,8 @@ bool BluetoothBlacklist::IsExcluded(const BluetoothUUID& uuid) const {
bool BluetoothBlacklist::IsExcluded(
const mojo::Array<blink::mojom::WebBluetoothScanFilterPtr>& filters) {
for (const blink::mojom::WebBluetoothScanFilterPtr& filter : filters) {
- for (const std::string& service : filter->services) {
- if (IsExcluded(BluetoothUUID(service))) {
+ for (const base::Optional<BluetoothUUID>& service : filter->services) {
+ if (IsExcluded(service.value())) {
return true;
}
}
@@ -114,9 +115,10 @@ bool BluetoothBlacklist::IsExcludedFromWrites(const BluetoothUUID& uuid) const {
void BluetoothBlacklist::RemoveExcludedUUIDs(
blink::mojom::WebBluetoothRequestDeviceOptions* options) {
- mojo::Array<mojo::String> optional_services_blacklist_filtered;
- for (const std::string& uuid : options->optional_services) {
- if (!IsExcluded(BluetoothUUID(uuid))) {
+ mojo::Array<base::Optional<BluetoothUUID>>
+ optional_services_blacklist_filtered;
+ for (const base::Optional<BluetoothUUID>& uuid : options->optional_services) {
+ if (!IsExcluded(uuid.value())) {
optional_services_blacklist_filtered.push_back(uuid);
}
}

Powered by Google App Engine
This is Rietveld 408576698