| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 if (adapter_) { | 67 if (adapter_) { |
| 68 adapter_->RemoveObserver(this); | 68 adapter_->RemoveObserver(this); |
| 69 adapter_ = NULL; | 69 adapter_ = NULL; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 void BluetoothLowEnergyConnectionFinder::Find( | 73 void BluetoothLowEnergyConnectionFinder::Find( |
| 74 const cryptauth::ConnectionFinder::ConnectionCallback& | 74 const cryptauth::ConnectionFinder::ConnectionCallback& |
| 75 connection_callback) { | 75 connection_callback) { |
| 76 if (!device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { | 76 if (!device::BluetoothAdapterFactory::IsBluetoothSupported()) { |
| 77 PA_LOG(WARNING) << "Bluetooth is unsupported on this platform. Aborting."; | 77 PA_LOG(WARNING) << "Bluetooth is unsupported on this platform. Aborting."; |
| 78 return; | 78 return; |
| 79 } | 79 } |
| 80 PA_LOG(INFO) << "Finding connection"; | 80 PA_LOG(INFO) << "Finding connection"; |
| 81 | 81 |
| 82 connection_callback_ = connection_callback; | 82 connection_callback_ = connection_callback; |
| 83 | 83 |
| 84 device::BluetoothAdapterFactory::GetAdapter( | 84 device::BluetoothAdapterFactory::GetAdapter( |
| 85 base::Bind(&BluetoothLowEnergyConnectionFinder::OnAdapterInitialized, | 85 base::Bind(&BluetoothLowEnergyConnectionFinder::OnAdapterInitialized, |
| 86 weak_ptr_factory_.GetWeakPtr())); | 86 weak_ptr_factory_.GetWeakPtr())); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 return device; | 310 return device; |
| 311 } | 311 } |
| 312 return nullptr; | 312 return nullptr; |
| 313 } | 313 } |
| 314 | 314 |
| 315 void BluetoothLowEnergyConnectionFinder::InvokeCallbackAsync() { | 315 void BluetoothLowEnergyConnectionFinder::InvokeCallbackAsync() { |
| 316 connection_callback_.Run(std::move(connection_)); | 316 connection_callback_.Run(std::move(connection_)); |
| 317 } | 317 } |
| 318 | 318 |
| 319 } // namespace proximity_auth | 319 } // namespace proximity_auth |
| OLD | NEW |