Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 // ScreenLocker creates a background view as well as ScreenLockView to | 41 // ScreenLocker creates a background view as well as ScreenLockView to |
| 42 // authenticate the user. ScreenLocker manages its life cycle and will | 42 // authenticate the user. ScreenLocker manages its life cycle and will |
| 43 // delete itself when it's unlocked. | 43 // delete itself when it's unlocked. |
| 44 class ScreenLocker : public LoginStatusConsumer, | 44 class ScreenLocker : public LoginStatusConsumer, |
| 45 public MessageBubbleDelegate, | 45 public MessageBubbleDelegate, |
| 46 public views::AcceleratorTarget { | 46 public views::AcceleratorTarget { |
| 47 public: | 47 public: |
| 48 explicit ScreenLocker(const UserManager::User& user); | 48 explicit ScreenLocker(const UserManager::User& user); |
| 49 | 49 |
| 50 // Returns the default instance if it has been created. | |
| 51 static ScreenLocker* default_screen_locker() { | |
| 52 return screen_locker_; | |
| 53 } | |
| 54 | |
| 50 // Initialize and show the screen locker. | 55 // Initialize and show the screen locker. |
| 51 void Init(); | 56 void Init(); |
| 52 | 57 |
| 53 // LoginStatusConsumer implements: | 58 // LoginStatusConsumer implements: |
| 54 virtual void OnLoginFailure(const chromeos::LoginFailure& error); | 59 virtual void OnLoginFailure(const chromeos::LoginFailure& error); |
| 55 virtual void OnLoginSuccess(const std::string& username, | 60 virtual void OnLoginSuccess(const std::string& username, |
| 56 const std::string& password, | 61 const std::string& password, |
| 57 const GaiaAuthConsumer::ClientLoginResult& result, | 62 const GaiaAuthConsumer::ClientLoginResult& result, |
| 58 bool pending_requests); | 63 bool pending_requests); |
| 59 | 64 |
| 60 // Overridden from views::InfoBubbleDelegate. | 65 // Overridden from views::InfoBubbleDelegate. |
| 61 virtual void InfoBubbleClosing(InfoBubble* info_bubble, | 66 virtual void InfoBubbleClosing(InfoBubble* info_bubble, |
| 62 bool closed_by_escape); | 67 bool closed_by_escape); |
| 63 virtual bool CloseOnEscape() { return true; } | 68 virtual bool CloseOnEscape() { return true; } |
| 64 virtual bool FadeInOnShow() { return false; } | 69 virtual bool FadeInOnShow() { return false; } |
| 65 virtual void OnHelpLinkActivated() {} | 70 virtual void OnHelpLinkActivated() {} |
| 66 | 71 |
| 67 // Authenticates the user with given |password| and authenticator. | 72 // Authenticates the user with given |password| and authenticator. |
| 68 void Authenticate(const string16& password); | 73 void Authenticate(const string16& password); |
| 69 | 74 |
| 70 // Close message bubble to clear error messages. | 75 // Close message bubble to clear error messages. |
| 71 void ClearErrors(); | 76 void ClearErrors(); |
| 72 | 77 |
| 73 // (Re)enable input field. | 78 // (Re)enable input field. |
| 74 void EnableInput(); | 79 void EnableInput(); |
| 75 | 80 |
| 76 // Exit the chrome, which will sign out the current session. | 81 // Exit the chrome, which will sign out the current session. |
| 77 void Signout(); | 82 void Signout(); |
| 78 | 83 |
| 84 // Disables all UI needed and shows error bubble with |message|. | |
| 85 // If |sign_out_only| is true than all other input except "Sign Out" | |
|
whywhat
2010/11/25 15:40:37
than -> then
Nikita (slow)
2010/11/29 11:20:25
Done.
| |
| 86 // button is blocked. | |
| 87 void ShowErrorMessage(const std::wstring& message, bool sign_out_only); | |
| 88 | |
| 79 // Called when the all inputs are grabbed. | 89 // Called when the all inputs are grabbed. |
| 80 void OnGrabInputs(); | 90 void OnGrabInputs(); |
| 81 | 91 |
| 82 // Returns the user to authenticate. | 92 // Returns the user to authenticate. |
| 83 const UserManager::User& user() const { | 93 const UserManager::User& user() const { |
| 84 return user_; | 94 return user_; |
| 85 } | 95 } |
| 86 | 96 |
| 87 // Initialize ScreenLocker class. It will listen to | 97 // Initialize ScreenLocker class. It will listen to |
| 88 // LOGIN_USER_CHANGED notification so that the screen locker accepts | 98 // LOGIN_USER_CHANGED notification so that the screen locker accepts |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 110 | 120 |
| 111 // Sets the authenticator. | 121 // Sets the authenticator. |
| 112 void SetAuthenticator(Authenticator* authenticator); | 122 void SetAuthenticator(Authenticator* authenticator); |
| 113 | 123 |
| 114 // Called when the screen lock is ready. | 124 // Called when the screen lock is ready. |
| 115 void ScreenLockReady(); | 125 void ScreenLockReady(); |
| 116 | 126 |
| 117 // Called when the window manager is ready to handle locked state. | 127 // Called when the window manager is ready to handle locked state. |
| 118 void OnWindowManagerReady(); | 128 void OnWindowManagerReady(); |
| 119 | 129 |
| 130 // Shows error_info_ bubble with the |message| and |arrow_location| specified. | |
| 131 // Assumes that UI controls were locked before that. | |
| 132 void ShowErrorBubble(const std::wstring& message, | |
| 133 BubbleBorder::ArrowLocation arrow_location); | |
| 134 | |
| 120 // Stops screen saver. | 135 // Stops screen saver. |
| 121 void StopScreenSaver(); | 136 void StopScreenSaver(); |
| 122 | 137 |
| 123 // Starts screen saver. | 138 // Starts screen saver. |
| 124 void StartScreenSaver(); | 139 void StartScreenSaver(); |
| 125 | 140 |
| 126 // Overridden from AcceleratorTarget: | 141 // Overridden from AcceleratorTarget: |
| 127 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); | 142 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); |
| 128 | 143 |
| 129 // Event handler for client-event. | 144 // Event handler for client-event. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 base::Time start_time_; | 202 base::Time start_time_; |
| 188 // The time when the authentication is started. | 203 // The time when the authentication is started. |
| 189 base::Time authentication_start_time_; | 204 base::Time authentication_start_time_; |
| 190 | 205 |
| 191 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); | 206 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); |
| 192 }; | 207 }; |
| 193 | 208 |
| 194 } // namespace chromeos | 209 } // namespace chromeos |
| 195 | 210 |
| 196 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ | 211 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ |
| OLD | NEW |