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

Unified Diff: components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc

Issue 2244693002: bluetooth: Refactor how we update based on Advertising Data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typo Created 4 years, 4 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: components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc
diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc
index f13635443788c77a8edde52456cad872b9f235ee..f3ecaa6a8cb258af0c04a720da7bd70fa596efca 100644
--- a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc
+++ b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc
@@ -172,17 +172,15 @@ bool BluetoothLowEnergyConnectionFinder::IsRightDevice(
bool BluetoothLowEnergyConnectionFinder::HasService(
BluetoothDevice* remote_device) {
- if (remote_device) {
- PA_LOG(INFO) << "Device " << remote_device->GetAddress() << " has "
- << remote_device->GetUUIDs().size() << " services.";
- std::vector<device::BluetoothUUID> uuids = remote_device->GetUUIDs();
- for (const auto& service_uuid : uuids) {
- if (remote_service_uuid_ == service_uuid) {
- return true;
- }
- }
+ if (!remote_device) {
+ return false;
}
- return false;
+
+ BluetoothDevice::UUIDSet uuids = remote_device->GetUUIDs();
+
+ PA_LOG(INFO) << "Device " << remote_device->GetAddress() << " has "
+ << uuids.size() << " services.";
+ return base::ContainsKey(uuids, remote_service_uuid_);
}
void BluetoothLowEnergyConnectionFinder::OnAdapterInitialized(

Powered by Google App Engine
This is Rietveld 408576698