| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Returns the tester | 124 // Returns the tester |
| 125 static test::ScreenLockerTester* GetTester(); | 125 static test::ScreenLockerTester* GetTester(); |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 friend class base::DeleteHelper<ScreenLocker>; | 128 friend class base::DeleteHelper<ScreenLocker>; |
| 129 friend class test::ScreenLockerTester; | 129 friend class test::ScreenLockerTester; |
| 130 friend class test::ScreenLockerViewsTester; | 130 friend class test::ScreenLockerViewsTester; |
| 131 friend class test::WebUIScreenLockerTester; | 131 friend class test::WebUIScreenLockerTester; |
| 132 friend class ScreenLockerDelegate; | 132 friend class ScreenLockerDelegate; |
| 133 | 133 |
| 134 // Track whether the user used pin or password to unlock the lock screen. |
| 135 // Values corrospond to UMA histograms, do not modify, or add or delete other |
| 136 // than directly before AUTH_COUNT. |
| 137 enum UnlockType { AUTH_PASSWORD = 0, AUTH_PIN, AUTH_COUNT }; |
| 138 |
| 134 struct AuthenticationParametersCapture { | 139 struct AuthenticationParametersCapture { |
| 135 UserContext user_context; | 140 UserContext user_context; |
| 136 }; | 141 }; |
| 137 | 142 |
| 138 ~ScreenLocker() override; | 143 ~ScreenLocker() override; |
| 139 | 144 |
| 140 // Sets the authenticator. | 145 // Sets the authenticator. |
| 141 void SetAuthenticator(Authenticator* authenticator); | 146 void SetAuthenticator(Authenticator* authenticator); |
| 142 | 147 |
| 143 // Called when the screen lock is ready. | 148 // Called when the screen lock is ready. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 160 | 165 |
| 161 // Used to authenticate the user to unlock. | 166 // Used to authenticate the user to unlock. |
| 162 scoped_refptr<Authenticator> authenticator_; | 167 scoped_refptr<Authenticator> authenticator_; |
| 163 | 168 |
| 164 // Used to authenticate the user to unlock supervised users. | 169 // Used to authenticate the user to unlock supervised users. |
| 165 scoped_refptr<ExtendedAuthenticator> extended_authenticator_; | 170 scoped_refptr<ExtendedAuthenticator> extended_authenticator_; |
| 166 | 171 |
| 167 // True if the screen is locked, or false otherwise. This changes | 172 // True if the screen is locked, or false otherwise. This changes |
| 168 // from false to true, but will never change from true to | 173 // from false to true, but will never change from true to |
| 169 // false. Instead, ScreenLocker object gets deleted when unlocked. | 174 // false. Instead, ScreenLocker object gets deleted when unlocked. |
| 170 bool locked_; | 175 bool locked_ = false; |
| 171 | 176 |
| 172 // Reference to the single instance of the screen locker object. | 177 // Reference to the single instance of the screen locker object. |
| 173 // This is used to make sure there is only one screen locker instance. | 178 // This is used to make sure there is only one screen locker instance. |
| 174 static ScreenLocker* screen_locker_; | 179 static ScreenLocker* screen_locker_; |
| 175 | 180 |
| 176 // The time when the screen locker object is created. | 181 // The time when the screen locker object is created. |
| 177 base::Time start_time_; | 182 base::Time start_time_ = base::Time::Now(); |
| 178 // The time when the authentication is started. | 183 // The time when the authentication is started. |
| 179 base::Time authentication_start_time_; | 184 base::Time authentication_start_time_; |
| 180 | 185 |
| 181 // Delegate to forward all login status events to. | 186 // Delegate to forward all login status events to. |
| 182 // Tests can use this to receive login status events. | 187 // Tests can use this to receive login status events. |
| 183 AuthStatusConsumer* auth_status_consumer_; | 188 AuthStatusConsumer* auth_status_consumer_ = nullptr; |
| 184 | 189 |
| 185 // Number of bad login attempts in a row. | 190 // Number of bad login attempts in a row. |
| 186 int incorrect_passwords_count_; | 191 int incorrect_passwords_count_ = 0; |
| 192 |
| 193 // Whether the last password entered was a pin or not. |
| 194 bool is_pin_attempt_ = false; |
| 187 | 195 |
| 188 // Copy of parameters passed to last call of OnLoginSuccess for usage in | 196 // Copy of parameters passed to last call of OnLoginSuccess for usage in |
| 189 // UnlockOnLoginSuccess(). | 197 // UnlockOnLoginSuccess(). |
| 190 std::unique_ptr<AuthenticationParametersCapture> authentication_capture_; | 198 std::unique_ptr<AuthenticationParametersCapture> authentication_capture_; |
| 191 | 199 |
| 192 // Provider for button icon set by the screenlockPrivate API. | 200 // Provider for button icon set by the screenlockPrivate API. |
| 193 std::unique_ptr<ScreenlockIconProvider> screenlock_icon_provider_; | 201 std::unique_ptr<ScreenlockIconProvider> screenlock_icon_provider_; |
| 194 | 202 |
| 195 scoped_refptr<input_method::InputMethodManager::State> saved_ime_state_; | 203 scoped_refptr<input_method::InputMethodManager::State> saved_ime_state_; |
| 196 | 204 |
| 197 base::WeakPtrFactory<ScreenLocker> weak_factory_; | 205 base::WeakPtrFactory<ScreenLocker> weak_factory_; |
| 198 | 206 |
| 199 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); | 207 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); |
| 200 }; | 208 }; |
| 201 | 209 |
| 202 } // namespace chromeos | 210 } // namespace chromeos |
| 203 | 211 |
| 204 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ | 212 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ |
| OLD | NEW |