OLD | NEW |
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 CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 FingerprintState state) = 0; | 95 FingerprintState state) = 0; |
96 | 96 |
97 // Returns the web contents used to back the lock screen. | 97 // Returns the web contents used to back the lock screen. |
98 // TODO(jdufault): Remove this function when we remove WebUIScreenLocker. | 98 // TODO(jdufault): Remove this function when we remove WebUIScreenLocker. |
99 virtual content::WebContents* GetWebContents() = 0; | 99 virtual content::WebContents* GetWebContents() = 0; |
100 | 100 |
101 private: | 101 private: |
102 DISALLOW_COPY_AND_ASSIGN(Delegate); | 102 DISALLOW_COPY_AND_ASSIGN(Delegate); |
103 }; | 103 }; |
104 | 104 |
| 105 using AuthenticateCallback = base::OnceCallback<void(bool auth_success)>; |
| 106 |
105 explicit ScreenLocker(const user_manager::UserList& users); | 107 explicit ScreenLocker(const user_manager::UserList& users); |
106 | 108 |
107 // Returns the default instance if it has been created. | 109 // Returns the default instance if it has been created. |
108 static ScreenLocker* default_screen_locker() { | 110 static ScreenLocker* default_screen_locker() { |
109 return screen_locker_; | 111 return screen_locker_; |
110 } | 112 } |
111 | 113 |
112 bool locked() const { return locked_; } | 114 bool locked() const { return locked_; } |
113 | 115 |
114 // Initialize and show the screen locker. | 116 // Initialize and show the screen locker. |
115 void Init(); | 117 void Init(); |
116 | 118 |
117 // AuthStatusConsumer: | 119 // AuthStatusConsumer: |
118 void OnAuthFailure(const chromeos::AuthFailure& error) override; | 120 void OnAuthFailure(const chromeos::AuthFailure& error) override; |
119 void OnAuthSuccess(const UserContext& user_context) override; | 121 void OnAuthSuccess(const UserContext& user_context) override; |
120 | 122 |
121 // Called when an account password (not PIN/quick unlock) has been used to | 123 // Called when an account password (not PIN/quick unlock) has been used to |
122 // unlock the device. | 124 // unlock the device. |
123 void OnPasswordAuthSuccess(const UserContext& user_context); | 125 void OnPasswordAuthSuccess(const UserContext& user_context); |
124 | 126 |
125 // Does actual unlocking once authentication is successful and all blocking | 127 // Does actual unlocking once authentication is successful and all blocking |
126 // animations are done. | 128 // animations are done. |
127 void UnlockOnLoginSuccess(); | 129 void UnlockOnLoginSuccess(); |
128 | 130 |
129 // Authenticates the user with given |user_context|. | 131 // Authenticates the user with given |user_context|. |
130 void Authenticate(const UserContext& user_context); | 132 void Authenticate(const UserContext& user_context, |
| 133 AuthenticateCallback callback); |
131 | 134 |
132 // Close message bubble to clear error messages. | 135 // Close message bubble to clear error messages. |
133 void ClearErrors(); | 136 void ClearErrors(); |
134 | 137 |
135 // Exit the chrome, which will sign out the current session. | 138 // Exit the chrome, which will sign out the current session. |
136 void Signout(); | 139 void Signout(); |
137 | 140 |
138 // (Re)enable input field. | 141 // (Re)enable input field. |
139 void EnableInput(); | 142 void EnableInput(); |
140 | 143 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // Delegate to forward all login status events to. | 265 // Delegate to forward all login status events to. |
263 // Tests can use this to receive login status events. | 266 // Tests can use this to receive login status events. |
264 AuthStatusConsumer* auth_status_consumer_ = nullptr; | 267 AuthStatusConsumer* auth_status_consumer_ = nullptr; |
265 | 268 |
266 // Number of bad login attempts in a row. | 269 // Number of bad login attempts in a row. |
267 int incorrect_passwords_count_ = 0; | 270 int incorrect_passwords_count_ = 0; |
268 | 271 |
269 // Type of the last unlock attempt. | 272 // Type of the last unlock attempt. |
270 UnlockType unlock_attempt_type_ = AUTH_PASSWORD; | 273 UnlockType unlock_attempt_type_ = AUTH_PASSWORD; |
271 | 274 |
| 275 // Callback to run, if any, when authentication is done. |
| 276 AuthenticateCallback on_auth_complete_; |
| 277 |
272 // Copy of parameters passed to last call of OnLoginSuccess for usage in | 278 // Copy of parameters passed to last call of OnLoginSuccess for usage in |
273 // UnlockOnLoginSuccess(). | 279 // UnlockOnLoginSuccess(). |
274 std::unique_ptr<AuthenticationParametersCapture> authentication_capture_; | 280 std::unique_ptr<AuthenticationParametersCapture> authentication_capture_; |
275 | 281 |
276 // Provider for button icon set by the screenlockPrivate API. | 282 // Provider for button icon set by the screenlockPrivate API. |
277 std::unique_ptr<ScreenlockIconProvider> screenlock_icon_provider_; | 283 std::unique_ptr<ScreenlockIconProvider> screenlock_icon_provider_; |
278 | 284 |
279 scoped_refptr<input_method::InputMethodManager::State> saved_ime_state_; | 285 scoped_refptr<input_method::InputMethodManager::State> saved_ime_state_; |
280 | 286 |
281 device::mojom::FingerprintPtr fp_service_; | 287 device::mojom::FingerprintPtr fp_service_; |
282 mojo::Binding<device::mojom::FingerprintObserver> binding_; | 288 mojo::Binding<device::mojom::FingerprintObserver> binding_; |
283 | 289 |
284 // ViewsScreenLocker instance in use. | 290 // ViewsScreenLocker instance in use. |
285 std::unique_ptr<ViewsScreenLocker> views_screen_locker_; | 291 std::unique_ptr<ViewsScreenLocker> views_screen_locker_; |
286 | 292 |
287 base::WeakPtrFactory<ScreenLocker> weak_factory_; | 293 base::WeakPtrFactory<ScreenLocker> weak_factory_; |
288 | 294 |
289 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); | 295 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); |
290 }; | 296 }; |
291 | 297 |
292 } // namespace chromeos | 298 } // namespace chromeos |
293 | 299 |
294 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ | 300 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ |
OLD | NEW |