| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bluetooth_connection_finder.h" | 5 #include "components/proximity_auth/bluetooth_connection_finder.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 has_delayed_poll_scheduled_(false), | 30 has_delayed_poll_scheduled_(false), |
| 31 weak_ptr_factory_(this) {} | 31 weak_ptr_factory_(this) {} |
| 32 | 32 |
| 33 BluetoothConnectionFinder::~BluetoothConnectionFinder() { | 33 BluetoothConnectionFinder::~BluetoothConnectionFinder() { |
| 34 UnregisterAsObserver(); | 34 UnregisterAsObserver(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void BluetoothConnectionFinder::Find( | 37 void BluetoothConnectionFinder::Find( |
| 38 const cryptauth::ConnectionFinder::ConnectionCallback& | 38 const cryptauth::ConnectionFinder::ConnectionCallback& |
| 39 connection_callback) { | 39 connection_callback) { |
| 40 if (!device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { | 40 if (!device::BluetoothAdapterFactory::IsBluetoothSupported()) { |
| 41 PA_LOG(WARNING) << "Bluetooth is unsupported on this platform. Aborting."; | 41 PA_LOG(WARNING) << "Bluetooth is unsupported on this platform. Aborting."; |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 | 44 |
| 45 DCHECK(start_time_.is_null()); | 45 DCHECK(start_time_.is_null()); |
| 46 | 46 |
| 47 start_time_ = base::TimeTicks::Now(); | 47 start_time_ = base::TimeTicks::Now(); |
| 48 connection_callback_ = connection_callback; | 48 connection_callback_ = connection_callback; |
| 49 | 49 |
| 50 device::BluetoothAdapterFactory::GetAdapter( | 50 device::BluetoothAdapterFactory::GetAdapter( |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 << "Connection failed! Scheduling another polling iteration."; | 202 << "Connection failed! Scheduling another polling iteration."; |
| 203 PostDelayedPoll(); | 203 PostDelayedPoll(); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 void BluetoothConnectionFinder::InvokeCallbackAsync() { | 207 void BluetoothConnectionFinder::InvokeCallbackAsync() { |
| 208 connection_callback_.Run(std::move(connection_)); | 208 connection_callback_.Run(std::move(connection_)); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace proximity_auth | 211 } // namespace proximity_auth |
| OLD | NEW |