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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 DCHECK(start_time_.is_null()); | 44 DCHECK(start_time_.is_null()); |
45 | 45 |
46 start_time_ = base::TimeTicks::Now(); | 46 start_time_ = base::TimeTicks::Now(); |
47 connection_callback_ = connection_callback; | 47 connection_callback_ = connection_callback; |
48 | 48 |
49 device::BluetoothAdapterFactory::GetAdapter( | 49 device::BluetoothAdapterFactory::GetAdapter( |
50 base::Bind(&BluetoothConnectionFinder::OnAdapterInitialized, | 50 base::Bind(&BluetoothConnectionFinder::OnAdapterInitialized, |
51 weak_ptr_factory_.GetWeakPtr())); | 51 weak_ptr_factory_.GetWeakPtr())); |
52 } | 52 } |
53 | 53 |
54 scoped_ptr<Connection> BluetoothConnectionFinder::CreateConnection() { | 54 std::unique_ptr<Connection> BluetoothConnectionFinder::CreateConnection() { |
55 return scoped_ptr<Connection>(new BluetoothConnection(remote_device_, uuid_)); | 55 return std::unique_ptr<Connection>( |
| 56 new BluetoothConnection(remote_device_, uuid_)); |
56 } | 57 } |
57 | 58 |
58 void BluetoothConnectionFinder::SeekDeviceByAddress( | 59 void BluetoothConnectionFinder::SeekDeviceByAddress( |
59 const std::string& bluetooth_address, | 60 const std::string& bluetooth_address, |
60 const base::Closure& callback, | 61 const base::Closure& callback, |
61 const bluetooth_util::ErrorCallback& error_callback) { | 62 const bluetooth_util::ErrorCallback& error_callback) { |
62 bluetooth_util::SeekDeviceByAddress( | 63 bluetooth_util::SeekDeviceByAddress( |
63 bluetooth_address, callback, error_callback, | 64 bluetooth_address, callback, error_callback, |
64 base::ThreadTaskRunnerHandle::Get().get()); | 65 base::ThreadTaskRunnerHandle::Get().get()); |
65 } | 66 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 << "Connection failed! Scheduling another polling iteration."; | 198 << "Connection failed! Scheduling another polling iteration."; |
198 PostDelayedPoll(); | 199 PostDelayedPoll(); |
199 } | 200 } |
200 } | 201 } |
201 | 202 |
202 void BluetoothConnectionFinder::InvokeCallbackAsync() { | 203 void BluetoothConnectionFinder::InvokeCallbackAsync() { |
203 connection_callback_.Run(std::move(connection_)); | 204 connection_callback_.Run(std::move(connection_)); |
204 } | 205 } |
205 | 206 |
206 } // namespace proximity_auth | 207 } // namespace proximity_auth |
OLD | NEW |