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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 class ScreenLockerTester; | 42 class ScreenLockerTester; |
43 class ScreenLockerViewsTester; | 43 class ScreenLockerViewsTester; |
44 class WebUIScreenLockerTester; | 44 class WebUIScreenLockerTester; |
45 } // namespace test | 45 } // namespace test |
46 | 46 |
47 // ScreenLocker creates a ScreenLockerDelegate which will display the lock UI. | 47 // ScreenLocker creates a ScreenLockerDelegate which will display the lock UI. |
48 // As well, it takes care of authenticating the user and managing a global | 48 // As well, it takes care of authenticating the user and managing a global |
49 // instance of itself which will be deleted when the system is unlocked. | 49 // instance of itself which will be deleted when the system is unlocked. |
50 class ScreenLocker : public AuthStatusConsumer { | 50 class ScreenLocker : public AuthStatusConsumer { |
51 public: | 51 public: |
52 enum UnlockSuccess { | |
jdufault
2016/08/16 17:55:02
Is it possible to make these enums private?
sammiequon
2016/08/16 19:22:11
Done.
| |
53 AUTH_SUCCESS_PASSWORD = 0, | |
54 AUTH_SUCCESS_PIN, | |
55 AUTH_SUCCESS_COUNT | |
56 }; | |
57 | |
58 enum UnlockFailure { | |
jdufault
2016/08/16 17:55:02
Do these need to be separate enums? Is it possible
sammiequon
2016/08/16 19:22:11
Done.
| |
59 AUTH_FAILURE_PASSWORD = 0, | |
60 AUTH_FAILURE_PIN, | |
61 AUTH_FAILURE_COUNT | |
62 }; | |
63 | |
52 explicit ScreenLocker(const user_manager::UserList& users); | 64 explicit ScreenLocker(const user_manager::UserList& users); |
53 | 65 |
54 // Returns the default instance if it has been created. | 66 // Returns the default instance if it has been created. |
55 static ScreenLocker* default_screen_locker() { | 67 static ScreenLocker* default_screen_locker() { |
56 return screen_locker_; | 68 return screen_locker_; |
57 } | 69 } |
58 | 70 |
59 bool locked() const { return locked_; } | 71 bool locked() const { return locked_; } |
60 | 72 |
61 // Initialize and show the screen locker. | 73 // Initialize and show the screen locker. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 | 172 |
161 // Used to authenticate the user to unlock. | 173 // Used to authenticate the user to unlock. |
162 scoped_refptr<Authenticator> authenticator_; | 174 scoped_refptr<Authenticator> authenticator_; |
163 | 175 |
164 // Used to authenticate the user to unlock supervised users. | 176 // Used to authenticate the user to unlock supervised users. |
165 scoped_refptr<ExtendedAuthenticator> extended_authenticator_; | 177 scoped_refptr<ExtendedAuthenticator> extended_authenticator_; |
166 | 178 |
167 // True if the screen is locked, or false otherwise. This changes | 179 // True if the screen is locked, or false otherwise. This changes |
168 // from false to true, but will never change from true to | 180 // from false to true, but will never change from true to |
169 // false. Instead, ScreenLocker object gets deleted when unlocked. | 181 // false. Instead, ScreenLocker object gets deleted when unlocked. |
170 bool locked_; | 182 bool locked_ = false; |
171 | 183 |
172 // Reference to the single instance of the screen locker object. | 184 // Reference to the single instance of the screen locker object. |
173 // This is used to make sure there is only one screen locker instance. | 185 // This is used to make sure there is only one screen locker instance. |
174 static ScreenLocker* screen_locker_; | 186 static ScreenLocker* screen_locker_; |
175 | 187 |
176 // The time when the screen locker object is created. | 188 // The time when the screen locker object is created. |
177 base::Time start_time_; | 189 base::Time start_time_; |
178 // The time when the authentication is started. | 190 // The time when the authentication is started. |
179 base::Time authentication_start_time_; | 191 base::Time authentication_start_time_; |
180 | 192 |
181 // Delegate to forward all login status events to. | 193 // Delegate to forward all login status events to. |
182 // Tests can use this to receive login status events. | 194 // Tests can use this to receive login status events. |
183 AuthStatusConsumer* auth_status_consumer_; | 195 AuthStatusConsumer* auth_status_consumer_; |
184 | 196 |
185 // Number of bad login attempts in a row. | 197 // Number of bad login attempts in a row. |
186 int incorrect_passwords_count_; | 198 int incorrect_passwords_count_ = 0; |
199 | |
200 // Whether the last password entered was a pin or not. | |
201 bool is_pin_attempt_ = false; | |
187 | 202 |
188 // Copy of parameters passed to last call of OnLoginSuccess for usage in | 203 // Copy of parameters passed to last call of OnLoginSuccess for usage in |
189 // UnlockOnLoginSuccess(). | 204 // UnlockOnLoginSuccess(). |
190 std::unique_ptr<AuthenticationParametersCapture> authentication_capture_; | 205 std::unique_ptr<AuthenticationParametersCapture> authentication_capture_; |
191 | 206 |
192 // Provider for button icon set by the screenlockPrivate API. | 207 // Provider for button icon set by the screenlockPrivate API. |
193 std::unique_ptr<ScreenlockIconProvider> screenlock_icon_provider_; | 208 std::unique_ptr<ScreenlockIconProvider> screenlock_icon_provider_; |
194 | 209 |
195 scoped_refptr<input_method::InputMethodManager::State> saved_ime_state_; | 210 scoped_refptr<input_method::InputMethodManager::State> saved_ime_state_; |
196 | 211 |
197 base::WeakPtrFactory<ScreenLocker> weak_factory_; | 212 base::WeakPtrFactory<ScreenLocker> weak_factory_; |
198 | 213 |
199 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); | 214 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); |
200 }; | 215 }; |
201 | 216 |
202 } // namespace chromeos | 217 } // namespace chromeos |
203 | 218 |
204 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ | 219 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ |
OLD | NEW |