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 #ifndef COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H |
6 #define COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H | 6 #define COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "components/cryptauth/authenticator.h" | 14 #include "components/cryptauth/authenticator.h" |
15 #include "components/cryptauth/bluetooth_throttler.h" | 15 #include "components/cryptauth/bluetooth_throttler.h" |
16 #include "components/cryptauth/connection.h" | 16 #include "components/cryptauth/connection.h" |
17 #include "components/cryptauth/connection_finder.h" | 17 #include "components/cryptauth/connection_finder.h" |
18 #include "components/cryptauth/remote_device.h" | 18 #include "components/cryptauth/remote_device.h" |
19 #include "components/proximity_auth/messenger_observer.h" | 19 #include "components/proximity_auth/messenger_observer.h" |
20 #include "components/proximity_auth/remote_device_life_cycle.h" | 20 #include "components/proximity_auth/remote_device_life_cycle.h" |
21 | 21 |
22 namespace cryptauth { | 22 namespace cryptauth { |
23 class SecureContext; | 23 class SecureContext; |
24 } | 24 } |
25 | 25 |
26 namespace proximity_auth { | 26 namespace proximity_auth { |
27 | 27 |
| 28 class BluetoothLowEnergyAdvertiser; |
28 class Messenger; | 29 class Messenger; |
29 class ProximityAuthClient; | 30 class ProximityAuthClient; |
30 | 31 |
31 // Implementation of RemoteDeviceLifeCycle. | 32 // Implementation of RemoteDeviceLifeCycle. |
32 class RemoteDeviceLifeCycleImpl : public RemoteDeviceLifeCycle, | 33 class RemoteDeviceLifeCycleImpl : public RemoteDeviceLifeCycle, |
33 public MessengerObserver { | 34 public MessengerObserver { |
34 public: | 35 public: |
35 // Creates the life cycle for controlling the given |remote_device|. | 36 // Creates the life cycle for controlling the given |remote_device|. |
36 // |proximity_auth_client| is not owned. | 37 // |proximity_auth_client| is not owned. |
37 RemoteDeviceLifeCycleImpl(const cryptauth::RemoteDevice& remote_device, | 38 RemoteDeviceLifeCycleImpl(const cryptauth::RemoteDevice& remote_device, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 std::unique_ptr<cryptauth::ConnectionFinder> connection_finder_; | 112 std::unique_ptr<cryptauth::ConnectionFinder> connection_finder_; |
112 | 113 |
113 // Rate limits Bluetooth connections to the same device. Used to in the | 114 // Rate limits Bluetooth connections to the same device. Used to in the |
114 // created cryptauth::ConnectionFinder. | 115 // created cryptauth::ConnectionFinder. |
115 cryptauth::BluetoothThrottler* bluetooth_throttler_; | 116 cryptauth::BluetoothThrottler* bluetooth_throttler_; |
116 | 117 |
117 // After authentication fails, this timer waits for a period of time before | 118 // After authentication fails, this timer waits for a period of time before |
118 // retrying the connection. | 119 // retrying the connection. |
119 base::OneShotTimer authentication_recovery_timer_; | 120 base::OneShotTimer authentication_recovery_timer_; |
120 | 121 |
| 122 std::unique_ptr<BluetoothLowEnergyAdvertiser> advertiser_; |
| 123 |
121 base::WeakPtrFactory<RemoteDeviceLifeCycleImpl> weak_ptr_factory_; | 124 base::WeakPtrFactory<RemoteDeviceLifeCycleImpl> weak_ptr_factory_; |
122 | 125 |
123 DISALLOW_COPY_AND_ASSIGN(RemoteDeviceLifeCycleImpl); | 126 DISALLOW_COPY_AND_ASSIGN(RemoteDeviceLifeCycleImpl); |
124 }; | 127 }; |
125 | 128 |
126 } // namespace proximity_auth | 129 } // namespace proximity_auth |
127 | 130 |
128 #endif // COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H | 131 #endif // COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H |
OLD | NEW |