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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Destroying the discovery session also stops it. | 246 // Destroying the discovery session also stops it. |
247 discovery_session_.reset(); | 247 discovery_session_.reset(); |
248 } | 248 } |
249 | 249 |
250 std::unique_ptr<Connection> | 250 std::unique_ptr<Connection> |
251 BluetoothLowEnergyConnectionFinder::CreateConnection( | 251 BluetoothLowEnergyConnectionFinder::CreateConnection( |
252 const std::string& device_address) { | 252 const std::string& device_address) { |
253 DCHECK(remote_device_.bluetooth_address.empty() || | 253 DCHECK(remote_device_.bluetooth_address.empty() || |
254 remote_device_.bluetooth_address == device_address); | 254 remote_device_.bluetooth_address == device_address); |
255 remote_device_.bluetooth_address = device_address; | 255 remote_device_.bluetooth_address = device_address; |
256 return base::WrapUnique(new BluetoothLowEnergyConnection( | 256 return base::MakeUnique<BluetoothLowEnergyConnection>( |
257 remote_device_, adapter_, remote_service_uuid_, bluetooth_throttler_, | 257 remote_device_, adapter_, remote_service_uuid_, bluetooth_throttler_, |
258 max_number_of_tries_)); | 258 max_number_of_tries_); |
259 } | 259 } |
260 | 260 |
261 void BluetoothLowEnergyConnectionFinder::OnConnectionStatusChanged( | 261 void BluetoothLowEnergyConnectionFinder::OnConnectionStatusChanged( |
262 Connection* connection, | 262 Connection* connection, |
263 Connection::Status old_status, | 263 Connection::Status old_status, |
264 Connection::Status new_status) { | 264 Connection::Status new_status) { |
265 DCHECK_EQ(connection, connection_.get()); | 265 DCHECK_EQ(connection, connection_.get()); |
266 PA_LOG(INFO) << "OnConnectionStatusChanged: " << old_status << " -> " | 266 PA_LOG(INFO) << "OnConnectionStatusChanged: " << old_status << " -> " |
267 << new_status; | 267 << new_status; |
268 | 268 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 return device; | 311 return device; |
312 } | 312 } |
313 return nullptr; | 313 return nullptr; |
314 } | 314 } |
315 | 315 |
316 void BluetoothLowEnergyConnectionFinder::InvokeCallbackAsync() { | 316 void BluetoothLowEnergyConnectionFinder::InvokeCallbackAsync() { |
317 connection_callback_.Run(std::move(connection_)); | 317 connection_callback_.Run(std::move(connection_)); |
318 } | 318 } |
319 | 319 |
320 } // namespace proximity_auth | 320 } // namespace proximity_auth |
OLD | NEW |