| 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/throttled_bluetooth_connection_finder.h" | 5 #include "components/proximity_auth/throttled_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" |
| 11 #include "base/task_runner.h" | 11 #include "base/task_runner.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "components/proximity_auth/bluetooth_connection_finder.h" | 13 #include "components/proximity_auth/bluetooth_connection_finder.h" |
| 14 #include "components/proximity_auth/bluetooth_throttler.h" | 14 #include "components/proximity_auth/bluetooth_throttler.h" |
| 15 | 15 |
| 16 namespace proximity_auth { | 16 namespace proximity_auth { |
| 17 | 17 |
| 18 ThrottledBluetoothConnectionFinder::ThrottledBluetoothConnectionFinder( | 18 ThrottledBluetoothConnectionFinder::ThrottledBluetoothConnectionFinder( |
| 19 scoped_ptr<BluetoothConnectionFinder> connection_finder, | 19 std::unique_ptr<BluetoothConnectionFinder> connection_finder, |
| 20 scoped_refptr<base::TaskRunner> task_runner, | 20 scoped_refptr<base::TaskRunner> task_runner, |
| 21 BluetoothThrottler* throttler) | 21 BluetoothThrottler* throttler) |
| 22 : connection_finder_(std::move(connection_finder)), | 22 : connection_finder_(std::move(connection_finder)), |
| 23 task_runner_(task_runner), | 23 task_runner_(task_runner), |
| 24 throttler_(throttler), | 24 throttler_(throttler), |
| 25 weak_ptr_factory_(this) {} | 25 weak_ptr_factory_(this) {} |
| 26 | 26 |
| 27 ThrottledBluetoothConnectionFinder::~ThrottledBluetoothConnectionFinder() { | 27 ThrottledBluetoothConnectionFinder::~ThrottledBluetoothConnectionFinder() { |
| 28 } | 28 } |
| 29 | 29 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 | 43 |
| 44 connection_finder_->Find( | 44 connection_finder_->Find( |
| 45 base::Bind(&ThrottledBluetoothConnectionFinder::OnConnection, | 45 base::Bind(&ThrottledBluetoothConnectionFinder::OnConnection, |
| 46 weak_ptr_factory_.GetWeakPtr(), connection_callback)); | 46 weak_ptr_factory_.GetWeakPtr(), connection_callback)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void ThrottledBluetoothConnectionFinder::OnConnection( | 49 void ThrottledBluetoothConnectionFinder::OnConnection( |
| 50 const ConnectionCallback& connection_callback, | 50 const ConnectionCallback& connection_callback, |
| 51 scoped_ptr<Connection> connection) { | 51 std::unique_ptr<Connection> connection) { |
| 52 throttler_->OnConnection(connection.get()); | 52 throttler_->OnConnection(connection.get()); |
| 53 connection_callback.Run(std::move(connection)); | 53 connection_callback.Run(std::move(connection)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace proximity_auth | 56 } // namespace proximity_auth |
| OLD | NEW |