| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SCREEN_LOCKER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // ScreenLocker creates a ScreenLockerDelegate which will display the lock UI. | 28 // ScreenLocker creates a ScreenLockerDelegate which will display the lock UI. |
| 29 // As well, it takes care of authenticating the user and managing a global | 29 // As well, it takes care of authenticating the user and managing a global |
| 30 // instance of itself which will be deleted when the system is unlocked. | 30 // instance of itself which will be deleted when the system is unlocked. |
| 31 class ScreenLocker : public LoginStatusConsumer { | 31 class ScreenLocker : public LoginStatusConsumer { |
| 32 public: | 32 public: |
| 33 explicit ScreenLocker(const User& user); | 33 explicit ScreenLocker(const User& user); |
| 34 | 34 |
| 35 // Returns the default instance if it has been created. | 35 // Returns the default instance if it has been created. |
| 36 static ScreenLocker* default_screen_locker() { | 36 static ScreenLocker* default_screen_locker() { |
| 37 #if defined(TOOLKIT_USES_GTK) | |
| 38 return screen_locker_; | 37 return screen_locker_; |
| 39 #else | |
| 40 NOTIMPLEMENTED(); | |
| 41 return NULL; | |
| 42 #endif | |
| 43 } | 38 } |
| 44 | 39 |
| 45 // Initialize and show the screen locker. | 40 // Initialize and show the screen locker. |
| 46 void Init(); | 41 void Init(); |
| 47 | 42 |
| 48 // LoginStatusConsumer implements: | 43 // LoginStatusConsumer implements: |
| 49 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; | 44 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; |
| 50 virtual void OnLoginSuccess(const std::string& username, | 45 virtual void OnLoginSuccess(const std::string& username, |
| 51 const std::string& password, | 46 const std::string& password, |
| 52 const GaiaAuthConsumer::ClientLoginResult& result, | 47 const GaiaAuthConsumer::ClientLoginResult& result, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 113 |
| 119 // Called when the screen lock is ready. | 114 // Called when the screen lock is ready. |
| 120 void ScreenLockReady(); | 115 void ScreenLockReady(); |
| 121 | 116 |
| 122 // ScreenLockerDelegate instance in use. | 117 // ScreenLockerDelegate instance in use. |
| 123 scoped_ptr<ScreenLockerDelegate> delegate_; | 118 scoped_ptr<ScreenLockerDelegate> delegate_; |
| 124 | 119 |
| 125 // Logged in user. | 120 // Logged in user. |
| 126 const User& user_; | 121 const User& user_; |
| 127 | 122 |
| 128 #if defined(TOOLKIT_USES_GTK) | |
| 129 // Used to authenticate the user to unlock. | 123 // Used to authenticate the user to unlock. |
| 130 scoped_refptr<Authenticator> authenticator_; | 124 scoped_refptr<Authenticator> authenticator_; |
| 131 #endif | |
| 132 | 125 |
| 133 // Unlock the screen when it detects key/mouse event without asking | 126 // Unlock the screen when it detects key/mouse event without asking |
| 134 // password. True when chrome is in BWSI or auto login mode. | 127 // password. True when chrome is in BWSI or auto login mode. |
| 135 bool unlock_on_input_; | 128 bool unlock_on_input_; |
| 136 | 129 |
| 137 // True if the screen is locked, or false otherwise. This changes | 130 // True if the screen is locked, or false otherwise. This changes |
| 138 // from false to true, but will never change from true to | 131 // from false to true, but will never change from true to |
| 139 // false. Instead, ScreenLocker object gets deleted when unlocked. | 132 // false. Instead, ScreenLocker object gets deleted when unlocked. |
| 140 bool locked_; | 133 bool locked_; |
| 141 | 134 |
| 142 // Reference to the single instance of the screen locker object. | 135 // Reference to the single instance of the screen locker object. |
| 143 // This is used to make sure there is only one screen locker instance. | 136 // This is used to make sure there is only one screen locker instance. |
| 144 static ScreenLocker* screen_locker_; | 137 static ScreenLocker* screen_locker_; |
| 145 | 138 |
| 146 // The time when the screen locker object is created. | 139 // The time when the screen locker object is created. |
| 147 base::Time start_time_; | 140 base::Time start_time_; |
| 148 // The time when the authentication is started. | 141 // The time when the authentication is started. |
| 149 base::Time authentication_start_time_; | 142 base::Time authentication_start_time_; |
| 150 | 143 |
| 151 // Delegate to forward all login status events to. | 144 // Delegate to forward all login status events to. |
| 152 // Tests can use this to receive login status events. | 145 // Tests can use this to receive login status events. |
| 153 LoginStatusConsumer* login_status_consumer_; | 146 LoginStatusConsumer* login_status_consumer_; |
| 154 | 147 |
| 155 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); | 148 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); |
| 156 }; | 149 }; |
| 157 | 150 |
| 158 } // namespace chromeos | 151 } // namespace chromeos |
| 159 | 152 |
| 160 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ | 153 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ |
| OLD | NEW |