OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h
" | 5 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h
" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 PA_LOG(INFO) << "Connecting to paired device " << device->GetAddress() | 138 PA_LOG(INFO) << "Connecting to paired device " << device->GetAddress() |
139 << " with service (" << HasService(device) | 139 << " with service (" << HasService(device) |
140 << ") or is whitelisted (" | 140 << ") or is whitelisted (" |
141 << device_whitelist_->HasDeviceWithAddress( | 141 << device_whitelist_->HasDeviceWithAddress( |
142 device->GetAddress()) << ")"; | 142 device->GetAddress()) << ")"; |
143 | 143 |
144 connection_ = CreateConnection(device->GetAddress()); | 144 connection_ = CreateConnection(device->GetAddress()); |
145 connection_->AddObserver(this); | 145 connection_->AddObserver(this); |
146 connection_->Connect(); | 146 connection_->Connect(); |
147 | 147 |
148 adapter_->RemoveObserver(this); | |
149 StopDiscoverySession(); | 148 StopDiscoverySession(); |
150 } | 149 } |
151 } | 150 } |
152 | 151 |
153 void BluetoothLowEnergyConnectionFinder::OnAdapterInitialized( | 152 void BluetoothLowEnergyConnectionFinder::OnAdapterInitialized( |
154 scoped_refptr<BluetoothAdapter> adapter) { | 153 scoped_refptr<BluetoothAdapter> adapter) { |
155 PA_LOG(INFO) << "Adapter ready"; | 154 PA_LOG(INFO) << "Adapter ready"; |
156 | 155 |
157 adapter_ = adapter; | 156 adapter_ = adapter; |
158 adapter_->AddObserver(this); | 157 adapter_->AddObserver(this); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // (see crbug.com/497841). | 309 // (see crbug.com/497841). |
311 std::vector<BluetoothDevice*> devices = adapter_->GetDevices(); | 310 std::vector<BluetoothDevice*> devices = adapter_->GetDevices(); |
312 for (const auto& device : devices) { | 311 for (const auto& device : devices) { |
313 if (device->GetAddress() == device_address) | 312 if (device->GetAddress() == device_address) |
314 return device; | 313 return device; |
315 } | 314 } |
316 return nullptr; | 315 return nullptr; |
317 } | 316 } |
318 | 317 |
319 } // namespace proximity_auth | 318 } // namespace proximity_auth |
OLD | NEW |