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

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

Issue 1372283002: Hook up ProximityAuthSystem in EasyUnlockService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_connection
Patch Set: fix msan tests Created 5 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 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_UNLOCK_MANAGER_H 5 #ifndef COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_H
6 #define COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_H 6 #define COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_H
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 bool IsUnlockAllowed(); 55 bool IsUnlockAllowed();
56 56
57 // Sets the |life_cycle| of the rmeote device to which local events are 57 // Sets the |life_cycle| of the rmeote device to which local events are
58 // dispatched. A null |life_cycle| indicates that proximity-based 58 // dispatched. A null |life_cycle| indicates that proximity-based
59 // authentication is inactive. 59 // authentication is inactive.
60 void SetRemoteDeviceLifeCycle(RemoteDeviceLifeCycle* life_cycle); 60 void SetRemoteDeviceLifeCycle(RemoteDeviceLifeCycle* life_cycle);
61 61
62 // Called when the life cycle's state changes. 62 // Called when the life cycle's state changes.
63 void OnLifeCycleStateChanged(); 63 void OnLifeCycleStateChanged();
64 64
65 protected:
66 // Called when the user pod is clicked for an authentication attempt of type 65 // Called when the user pod is clicked for an authentication attempt of type
67 // |auth_type|. 66 // |auth_type|.
68 // Exposed for testing. 67 // Exposed for testing.
69 void OnAuthAttempted(ScreenlockBridge::LockHandler::AuthType auth_type); 68 void OnAuthAttempted(ScreenlockBridge::LockHandler::AuthType auth_type);
70 69
71 private: 70 private:
72 // The possible lock screen states for the remote device. 71 // The possible lock screen states for the remote device.
73 enum class RemoteScreenlockState { 72 enum class RemoteScreenlockState {
74 UNKNOWN, 73 UNKNOWN,
75 UNLOCKED, 74 UNLOCKED,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 127
129 // Accepts or rejects the current auth attempt according to |should_accept|. 128 // Accepts or rejects the current auth attempt according to |should_accept|.
130 // If the auth attempt is accepted, unlocks the screen. 129 // If the auth attempt is accepted, unlocks the screen.
131 void AcceptAuthAttempt(bool should_accept); 130 void AcceptAuthAttempt(bool should_accept);
132 131
133 // Returns the screen lock state corresponding to the given remote |status| 132 // Returns the screen lock state corresponding to the given remote |status|
134 // update. 133 // update.
135 RemoteScreenlockState GetScreenlockStateFromRemoteUpdate( 134 RemoteScreenlockState GetScreenlockStateFromRemoteUpdate(
136 RemoteStatusUpdate update); 135 RemoteStatusUpdate update);
137 136
137 // Returns the Messenger instance associated with |life_cycle_|. This function
138 // will return nullptr if |life_cycle_| is not set or the remote device is not
139 // yet authenticated.
140 Messenger* GetMessenger();
141
138 // Whether |this| manager is being used for sign-in or session unlock. 142 // Whether |this| manager is being used for sign-in or session unlock.
139 const ScreenlockType screenlock_type_; 143 const ScreenlockType screenlock_type_;
140 144
141 // Whether the user is present at the remote device. Unset if no remote status 145 // Whether the user is present at the remote device. Unset if no remote status
142 // update has yet been received. 146 // update has yet been received.
143 scoped_ptr<RemoteScreenlockState> remote_screenlock_state_; 147 scoped_ptr<RemoteScreenlockState> remote_screenlock_state_;
144 148
145 // Controls the proximity auth flow logic for a remote device. Not owned, and 149 // Controls the proximity auth flow logic for a remote device. Not owned, and
146 // expcted to outlive |this| instance. 150 // expcted to outlive |this| instance.
147 RemoteDeviceLifeCycle* life_cycle_; 151 RemoteDeviceLifeCycle* life_cycle_;
148 152
149 // The messenger used to communicate with the remote device once a secure
150 // channel
151 // is established. Null if no secure channel has been established yet. Not
152 // owned, and expected to outlive |this| instance.
153 Messenger* messenger_;
154
155 // Tracks whether the remote device is currently in close enough proximity to 153 // Tracks whether the remote device is currently in close enough proximity to
156 // the local device to allow unlocking. 154 // the local device to allow unlocking.
157 scoped_ptr<ProximityMonitor> proximity_monitor_; 155 scoped_ptr<ProximityMonitor> proximity_monitor_;
158 156
159 // Used to call into the embedder. Expected to outlive |this| instance. 157 // Used to call into the embedder. Expected to outlive |this| instance.
160 ProximityAuthClient* proximity_auth_client_; 158 ProximityAuthClient* proximity_auth_client_;
161 159
162 // Whether the screen is currently locked. 160 // Whether the screen is currently locked.
163 bool is_locked_; 161 bool is_locked_;
164 162
(...skipping 25 matching lines...) Expand all
190 188
191 // Used to vend all other weak pointers. 189 // Used to vend all other weak pointers.
192 base::WeakPtrFactory<UnlockManager> weak_ptr_factory_; 190 base::WeakPtrFactory<UnlockManager> weak_ptr_factory_;
193 191
194 DISALLOW_COPY_AND_ASSIGN(UnlockManager); 192 DISALLOW_COPY_AND_ASSIGN(UnlockManager);
195 }; 193 };
196 194
197 } // namespace proximity_auth 195 } // namespace proximity_auth
198 196
199 #endif // COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_H 197 #endif // COMPONENTS_PROXIMITY_AUTH_UNLOCK_MANAGER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698