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

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

Issue 1922923002: bluetooth: Move requestDevice to mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-separate-tests-request-device
Patch Set: Remove debug log Created 4 years, 7 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 6564c4c4b90cf4a4af1d4237692bc0bd11a07ac4..44ecab449176b49eedc7dd66d35064deb5fe77d3 100644
--- a/content/browser/bluetooth/bluetooth_blacklist.cc
+++ b/content/browser/bluetooth/bluetooth_blacklist.cc
@@ -7,7 +7,6 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_split.h"
-#include "content/common/bluetooth/bluetooth_scan_filter.h"
#include "content/public/browser/content_browser_client.h"
using device::BluetoothUUID;
@@ -86,10 +85,10 @@ bool BluetoothBlacklist::IsExcluded(const BluetoothUUID& uuid) const {
}
bool BluetoothBlacklist::IsExcluded(
- const std::vector<content::BluetoothScanFilter>& filters) {
- for (const BluetoothScanFilter& filter : filters) {
- for (const BluetoothUUID& service : filter.services) {
- if (IsExcluded(service)) {
+ 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))) {
return true;
}
}
@@ -113,16 +112,15 @@ bool BluetoothBlacklist::IsExcludedFromWrites(const BluetoothUUID& uuid) const {
return it->second == Value::EXCLUDE || it->second == Value::EXCLUDE_WRITES;
}
-void BluetoothBlacklist::RemoveExcludedUuids(
- std::vector<device::BluetoothUUID>* uuids) {
- auto it = uuids->begin();
- while (it != uuids->end()) {
- if (IsExcluded(*it)) {
- it = uuids->erase(it);
- } else {
- it++;
+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))) {
+ optional_services_blacklist_filtered.push_back(uuid);
}
}
+ options->optional_services = std::move(optional_services_blacklist_filtered);
}
void BluetoothBlacklist::ResetToDefaultValuesForTest() {

Powered by Google App Engine
This is Rietveld 408576698