| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 void BluetoothConnectionFinder::Find( | 35 void BluetoothConnectionFinder::Find( |
| 36 const ConnectionCallback& connection_callback) { | 36 const ConnectionCallback& connection_callback) { |
| 37 if (!device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { | 37 if (!device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { |
| 38 PA_LOG(WARNING) << "Bluetooth is unsupported on this platform. Aborting."; | 38 PA_LOG(WARNING) << "Bluetooth is unsupported on this platform. Aborting."; |
| 39 return; | 39 return; |
| 40 } | 40 } |
| 41 | 41 |
| 42 DCHECK(start_time_.is_null()); | 42 DCHECK(start_time_.is_null()); |
| 43 PA_LOG(WARNING) << "Finding Bluetooth connection..."; | |
| 44 | 43 |
| 45 start_time_ = base::TimeTicks::Now(); | 44 start_time_ = base::TimeTicks::Now(); |
| 46 connection_callback_ = connection_callback; | 45 connection_callback_ = connection_callback; |
| 47 | 46 |
| 48 device::BluetoothAdapterFactory::GetAdapter( | 47 device::BluetoothAdapterFactory::GetAdapter( |
| 49 base::Bind(&BluetoothConnectionFinder::OnAdapterInitialized, | 48 base::Bind(&BluetoothConnectionFinder::OnAdapterInitialized, |
| 50 weak_ptr_factory_.GetWeakPtr())); | 49 weak_ptr_factory_.GetWeakPtr())); |
| 51 } | 50 } |
| 52 | 51 |
| 53 scoped_ptr<Connection> BluetoothConnectionFinder::CreateConnection() { | 52 scoped_ptr<Connection> BluetoothConnectionFinder::CreateConnection() { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 << "Connection failed! Scheduling another polling iteration."; | 195 << "Connection failed! Scheduling another polling iteration."; |
| 197 PostDelayedPoll(); | 196 PostDelayedPoll(); |
| 198 } | 197 } |
| 199 } | 198 } |
| 200 | 199 |
| 201 void BluetoothConnectionFinder::InvokeCallbackAsync() { | 200 void BluetoothConnectionFinder::InvokeCallbackAsync() { |
| 202 connection_callback_.Run(connection_.Pass()); | 201 connection_callback_.Run(connection_.Pass()); |
| 203 } | 202 } |
| 204 | 203 |
| 205 } // namespace proximity_auth | 204 } // namespace proximity_auth |
| OLD | NEW |