Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: components/proximity_auth/throttled_bluetooth_connection_finder.h

Issue 1912433002: Convert //components/proximity_auth from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef COMPONENTS_PROXIMITY_AUTH_THROTTLED_BLUETOOTH_CONNECTION_FINDER_H 5 #ifndef COMPONENTS_PROXIMITY_AUTH_THROTTLED_BLUETOOTH_CONNECTION_FINDER_H
6 #define COMPONENTS_PROXIMITY_AUTH_THROTTLED_BLUETOOTH_CONNECTION_FINDER_H 6 #define COMPONENTS_PROXIMITY_AUTH_THROTTLED_BLUETOOTH_CONNECTION_FINDER_H
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "components/proximity_auth/connection_finder.h" 13 #include "components/proximity_auth/connection_finder.h"
13 14
14 namespace base { 15 namespace base {
15 class TaskRunner; 16 class TaskRunner;
16 } 17 }
17 18
18 namespace proximity_auth { 19 namespace proximity_auth {
19 20
20 class BluetoothConnectionFinder; 21 class BluetoothConnectionFinder;
21 class BluetoothThrottler; 22 class BluetoothThrottler;
22 class Connection; 23 class Connection;
23 24
24 // A Bluetooth connection finder that delays Find() requests according to the 25 // A Bluetooth connection finder that delays Find() requests according to the
25 // throttler's cooldown period. 26 // throttler's cooldown period.
26 class ThrottledBluetoothConnectionFinder : public ConnectionFinder { 27 class ThrottledBluetoothConnectionFinder : public ConnectionFinder {
27 public: 28 public:
28 // Note: The |throttler| is not owned, and must outlive |this| instance. 29 // Note: The |throttler| is not owned, and must outlive |this| instance.
29 ThrottledBluetoothConnectionFinder( 30 ThrottledBluetoothConnectionFinder(
30 scoped_ptr<BluetoothConnectionFinder> connection_finder, 31 std::unique_ptr<BluetoothConnectionFinder> connection_finder,
31 scoped_refptr<base::TaskRunner> task_runner, 32 scoped_refptr<base::TaskRunner> task_runner,
32 BluetoothThrottler* throttler); 33 BluetoothThrottler* throttler);
33 ~ThrottledBluetoothConnectionFinder() override; 34 ~ThrottledBluetoothConnectionFinder() override;
34 35
35 // ConnectionFinder: 36 // ConnectionFinder:
36 void Find(const ConnectionCallback& connection_callback) override; 37 void Find(const ConnectionCallback& connection_callback) override;
37 38
38 private: 39 private:
39 // Callback to be called when a connection is found. 40 // Callback to be called when a connection is found.
40 void OnConnection(const ConnectionCallback& connection_callback, 41 void OnConnection(const ConnectionCallback& connection_callback,
41 scoped_ptr<Connection> connection); 42 std::unique_ptr<Connection> connection);
42 43
43 // The underlying connection finder. 44 // The underlying connection finder.
44 scoped_ptr<BluetoothConnectionFinder> connection_finder_; 45 std::unique_ptr<BluetoothConnectionFinder> connection_finder_;
45 46
46 // The task runner used for posting delayed messages. 47 // The task runner used for posting delayed messages.
47 scoped_refptr<base::TaskRunner> task_runner_; 48 scoped_refptr<base::TaskRunner> task_runner_;
48 49
49 // The throttler managing this connection finder. The throttler is not owned, 50 // The throttler managing this connection finder. The throttler is not owned,
50 // and must outlive |this| instance. 51 // and must outlive |this| instance.
51 BluetoothThrottler* throttler_; 52 BluetoothThrottler* throttler_;
52 53
53 base::WeakPtrFactory<ThrottledBluetoothConnectionFinder> weak_ptr_factory_; 54 base::WeakPtrFactory<ThrottledBluetoothConnectionFinder> weak_ptr_factory_;
54 55
55 DISALLOW_COPY_AND_ASSIGN(ThrottledBluetoothConnectionFinder); 56 DISALLOW_COPY_AND_ASSIGN(ThrottledBluetoothConnectionFinder);
56 }; 57 };
57 58
58 } // namespace proximity_auth 59 } // namespace proximity_auth
59 60
60 #endif // COMPONENTS_PROXIMITY_AUTH_THROTTLED_BLUETOOTH_CONNECTION_FINDER_H 61 #endif // COMPONENTS_PROXIMITY_AUTH_THROTTLED_BLUETOOTH_CONNECTION_FINDER_H
OLDNEW
« no previous file with comments | « components/proximity_auth/screenlock_bridge.cc ('k') | components/proximity_auth/throttled_bluetooth_connection_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698