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_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_H |
6 #define COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_H | 6 #define COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_H |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/proximity_auth/remote_device.h" | 9 #include "components/cryptauth/remote_device.h" |
10 | 10 |
11 namespace proximity_auth { | 11 namespace proximity_auth { |
12 | 12 |
13 class Messenger; | 13 class Messenger; |
14 | 14 |
15 // Controls the life cycle of connecting and authenticating to a remote device. | 15 // Controls the life cycle of connecting and authenticating to a remote device. |
16 // After the life cycle is started, it can be in the following states: | 16 // After the life cycle is started, it can be in the following states: |
17 // FINDING_CONNECTION: | 17 // FINDING_CONNECTION: |
18 // Continuiously attempts to create a connection to the remote device. | 18 // Continuiously attempts to create a connection to the remote device. |
19 // After connecting, transitions to the AUTHENTICATING state. | 19 // After connecting, transitions to the AUTHENTICATING state. |
(...skipping 28 matching lines...) Expand all Loading... |
48 // Called when the state in the life cycle changes. | 48 // Called when the state in the life cycle changes. |
49 virtual void OnLifeCycleStateChanged(State old_state, State new_state) = 0; | 49 virtual void OnLifeCycleStateChanged(State old_state, State new_state) = 0; |
50 }; | 50 }; |
51 | 51 |
52 virtual ~RemoteDeviceLifeCycle() {} | 52 virtual ~RemoteDeviceLifeCycle() {} |
53 | 53 |
54 // Starts the life cycle. | 54 // Starts the life cycle. |
55 virtual void Start() = 0; | 55 virtual void Start() = 0; |
56 | 56 |
57 // Returns the RemoteDevice instance that this life cycle manages. | 57 // Returns the RemoteDevice instance that this life cycle manages. |
58 virtual RemoteDevice GetRemoteDevice() const = 0; | 58 virtual cryptauth::RemoteDevice GetRemoteDevice() const = 0; |
59 | 59 |
60 // Returns the current state of in the life cycle. | 60 // Returns the current state of in the life cycle. |
61 virtual State GetState() const = 0; | 61 virtual State GetState() const = 0; |
62 | 62 |
63 // Returns the client for sending and receiving messages. This function will | 63 // Returns the client for sending and receiving messages. This function will |
64 // only return an instance if the state is SECURE_CHANNEL_ESTABLISHED; | 64 // only return an instance if the state is SECURE_CHANNEL_ESTABLISHED; |
65 // otherwise, it will return nullptr. | 65 // otherwise, it will return nullptr. |
66 virtual Messenger* GetMessenger() = 0; | 66 virtual Messenger* GetMessenger() = 0; |
67 | 67 |
68 // Adds an observer. | 68 // Adds an observer. |
69 virtual void AddObserver(Observer* observer) = 0; | 69 virtual void AddObserver(Observer* observer) = 0; |
70 | 70 |
71 // Removes an observer. | 71 // Removes an observer. |
72 virtual void RemoveObserver(Observer* observer) = 0; | 72 virtual void RemoveObserver(Observer* observer) = 0; |
73 }; | 73 }; |
74 | 74 |
75 } // namespace proximity_auth | 75 } // namespace proximity_auth |
76 | 76 |
77 #endif // COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_H | 77 #endif // COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_H |
OLD | NEW |