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

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

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 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 #ifndef COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_FINDER_H 5 #ifndef COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_FINDER_H
6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_FINDER_H 6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_FINDER_H
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 12 matching lines...) Expand all
23 23
24 // This ConnectionFinder implementation tries to find a Bluetooth connection to 24 // This ConnectionFinder implementation tries to find a Bluetooth connection to
25 // the remote device by polling at a fixed interval. 25 // the remote device by polling at a fixed interval.
26 class BluetoothConnectionFinder : public ConnectionFinder, 26 class BluetoothConnectionFinder : public ConnectionFinder,
27 public ConnectionObserver, 27 public ConnectionObserver,
28 public device::BluetoothAdapter::Observer { 28 public device::BluetoothAdapter::Observer {
29 public: 29 public:
30 BluetoothConnectionFinder(const RemoteDevice& remote_device, 30 BluetoothConnectionFinder(const RemoteDevice& remote_device,
31 const device::BluetoothUUID& uuid, 31 const device::BluetoothUUID& uuid,
32 const base::TimeDelta& polling_interval); 32 const base::TimeDelta& polling_interval);
33 virtual ~BluetoothConnectionFinder(); 33 ~BluetoothConnectionFinder() override;
34 34
35 // ConnectionFinder: 35 // ConnectionFinder:
36 virtual void Find(const ConnectionCallback& connection_callback) override; 36 void Find(const ConnectionCallback& connection_callback) override;
37 37
38 protected: 38 protected:
39 // Exposed for mocking out the connection in tests. 39 // Exposed for mocking out the connection in tests.
40 virtual scoped_ptr<Connection> CreateConnection(); 40 virtual scoped_ptr<Connection> CreateConnection();
41 41
42 // BluetoothAdapter::Observer: 42 // BluetoothAdapter::Observer:
43 virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter, 43 void AdapterPresentChanged(device::BluetoothAdapter* adapter,
44 bool present) override; 44 bool present) override;
45 virtual void AdapterPoweredChanged(device::BluetoothAdapter* adapter, 45 void AdapterPoweredChanged(device::BluetoothAdapter* adapter,
46 bool powered) override; 46 bool powered) override;
47 47
48 private: 48 private:
49 // Returns true iff the Bluetooth adapter is ready to make connections. 49 // Returns true iff the Bluetooth adapter is ready to make connections.
50 bool IsReadyToPoll(); 50 bool IsReadyToPoll();
51 51
52 // Attempts to connect to the |remote_device_| if the system is ready for 52 // Attempts to connect to the |remote_device_| if the system is ready for
53 // another iteration of polling. 53 // another iteration of polling.
54 void PollIfReady(); 54 void PollIfReady();
55 55
56 // Wrapper around |PollIfReady()| that can be posted as a delayed task. 56 // Wrapper around |PollIfReady()| that can be posted as a delayed task.
57 void DelayedPollIfReady(); 57 void DelayedPollIfReady();
58 58
59 // Unregisters |this| instance as an observer from all objects that it might 59 // Unregisters |this| instance as an observer from all objects that it might
60 // have registered with. 60 // have registered with.
61 void UnregisterAsObserver(); 61 void UnregisterAsObserver();
62 62
63 // Callback to be called when the Bluetooth adapter is initialized. 63 // Callback to be called when the Bluetooth adapter is initialized.
64 void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter); 64 void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter);
65 65
66 // ConnectionObserver: 66 // ConnectionObserver:
67 virtual void OnConnectionStatusChanged( 67 void OnConnectionStatusChanged(const Connection& connection,
68 const Connection& connection, 68 Connection::Status old_status,
69 Connection::Status old_status, 69 Connection::Status new_status) override;
70 Connection::Status new_status) override;
71 70
72 // The remote device to connect to. 71 // The remote device to connect to.
73 const RemoteDevice remote_device_; 72 const RemoteDevice remote_device_;
74 73
75 // The UUID of the service on the remote device. 74 // The UUID of the service on the remote device.
76 const device::BluetoothUUID uuid_; 75 const device::BluetoothUUID uuid_;
77 76
78 // The time to wait between polling attempts. 77 // The time to wait between polling attempts.
79 const base::TimeDelta polling_interval_; 78 const base::TimeDelta polling_interval_;
80 79
(...skipping 18 matching lines...) Expand all
99 DISALLOW_COPY_AND_ASSIGN(BluetoothConnectionFinder); 98 DISALLOW_COPY_AND_ASSIGN(BluetoothConnectionFinder);
100 }; 99 };
101 100
102 // TODO(isherman): Make sure to wire up the controller to listen for screen lock 101 // TODO(isherman): Make sure to wire up the controller to listen for screen lock
103 // state change events, and create or destroy the connection finder as 102 // state change events, and create or destroy the connection finder as
104 // appropriate. 103 // appropriate.
105 104
106 } // namespace proximity_auth 105 } // namespace proximity_auth
107 106
108 #endif // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_FINDER_H 107 #endif // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_CONNECTION_FINDER_H
OLDNEW
« no previous file with comments | « components/proximity_auth/bluetooth_connection.h ('k') | components/proximity_auth/bluetooth_connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698