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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // The remote device being controlled. | 74 // The remote device being controlled. |
75 const RemoteDevice remote_device_; | 75 const RemoteDevice remote_device_; |
76 | 76 |
77 // Used to grab dependencies in chrome. Not owned. | 77 // Used to grab dependencies in chrome. Not owned. |
78 ProximityAuthClient* proximity_auth_client_; | 78 ProximityAuthClient* proximity_auth_client_; |
79 | 79 |
80 // The current state in the life cycle. | 80 // The current state in the life cycle. |
81 RemoteDeviceLifeCycle::State state_; | 81 RemoteDeviceLifeCycle::State state_; |
82 | 82 |
83 // Observers added to the life cycle. | 83 // Observers added to the life cycle. Configured as NOTIFY_EXISTING_ONLY. |
84 base::ObserverList<Observer> observers_; | 84 base::ObserverList<Observer> observers_; |
85 | 85 |
86 // Rate limits Bluetooth connections to the same device. Used to in the | |
87 // created ConnectionFinder. | |
88 scoped_ptr<BluetoothThrottler> bluetooth_throttler_; | |
89 | |
90 // Used in the FINDING_CONNECTION state to establish a connection to the | |
91 // remote device. | |
92 scoped_ptr<ConnectionFinder> connection_finder_; | |
93 | |
94 // The connection that is established by |connection_finder_|. | 86 // The connection that is established by |connection_finder_|. |
95 scoped_ptr<Connection> connection_; | 87 scoped_ptr<Connection> connection_; |
96 | 88 |
97 // Authenticates the remote device after it is connected. Used in the | |
98 // AUTHENTICATING state. | |
99 scoped_ptr<Authenticator> authenticator_; | |
100 | |
101 // Context for encrypting and decrypting messages. Created after | 89 // Context for encrypting and decrypting messages. Created after |
102 // authentication succeeds. Ownership is eventually passed to |messenger_|. | 90 // authentication succeeds. Ownership is eventually passed to |messenger_|. |
103 scoped_ptr<SecureContext> secure_context_; | 91 scoped_ptr<SecureContext> secure_context_; |
104 | 92 |
105 // The messenger for sending and receiving messages in the | 93 // The messenger for sending and receiving messages in the |
106 // SECURE_CHANNEL_ESTABLISHED state. | 94 // SECURE_CHANNEL_ESTABLISHED state. |
107 scoped_ptr<Messenger> messenger_; | 95 scoped_ptr<Messenger> messenger_; |
108 | 96 |
| 97 // Authenticates the remote device after it is connected. Used in the |
| 98 // AUTHENTICATING state. |
| 99 scoped_ptr<Authenticator> authenticator_; |
| 100 |
| 101 // Used in the FINDING_CONNECTION state to establish a connection to the |
| 102 // remote device. |
| 103 scoped_ptr<ConnectionFinder> connection_finder_; |
| 104 |
| 105 // Rate limits Bluetooth connections to the same device. Used to in the |
| 106 // created ConnectionFinder. |
| 107 scoped_ptr<BluetoothThrottler> bluetooth_throttler_; |
| 108 |
109 // After authentication fails, this timer waits for a period of time before | 109 // After authentication fails, this timer waits for a period of time before |
110 // retrying the connection. | 110 // retrying the connection. |
111 base::OneShotTimer authentication_recovery_timer_; | 111 base::OneShotTimer authentication_recovery_timer_; |
112 | 112 |
113 base::WeakPtrFactory<RemoteDeviceLifeCycleImpl> weak_ptr_factory_; | 113 base::WeakPtrFactory<RemoteDeviceLifeCycleImpl> weak_ptr_factory_; |
114 | 114 |
115 DISALLOW_COPY_AND_ASSIGN(RemoteDeviceLifeCycleImpl); | 115 DISALLOW_COPY_AND_ASSIGN(RemoteDeviceLifeCycleImpl); |
116 }; | 116 }; |
117 | 117 |
118 } // namespace proximity_auth | 118 } // namespace proximity_auth |
119 | 119 |
120 #endif // COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H | 120 #endif // COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H |
OLD | NEW |