| 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_EXISTING_USER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/task.h" | 13 #include "base/task.h" |
| 14 #include "base/timer.h" | 14 #include "base/timer.h" |
| 15 #include "chrome/browser/chromeos/login/captcha_view.h" | 15 #include "chrome/browser/chromeos/login/captcha_view.h" |
| 16 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 16 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
| 17 #include "chrome/browser/chromeos/login/message_bubble.h" |
| 17 #include "chrome/browser/chromeos/login/password_changed_view.h" | 18 #include "chrome/browser/chromeos/login/password_changed_view.h" |
| 18 #include "chrome/browser/chromeos/login/user_manager.h" | 19 #include "chrome/browser/chromeos/login/user_manager.h" |
| 19 #include "chrome/browser/chromeos/login/user_controller.h" | 20 #include "chrome/browser/chromeos/login/user_controller.h" |
| 20 #include "chrome/browser/chromeos/wm_message_listener.h" | 21 #include "chrome/browser/chromeos/wm_message_listener.h" |
| 21 #include "chrome/browser/views/info_bubble.h" | |
| 22 #include "chrome/common/net/gaia/gaia_auth_consumer.h" | 22 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
| 23 #include "gfx/size.h" | 23 #include "gfx/size.h" |
| 24 | 24 |
| 25 namespace chromeos { | 25 namespace chromeos { |
| 26 | 26 |
| 27 class Authenticator; | 27 class Authenticator; |
| 28 class BackgroundView; | 28 class BackgroundView; |
| 29 class MessageBubble; | 29 class MessageBubble; |
| 30 | 30 |
| 31 // ExistingUserController is used to handle login when someone has already | 31 // ExistingUserController is used to handle login when someone has already |
| 32 // logged into the machine. When Init is invoked a UserController is created for | 32 // logged into the machine. When Init is invoked a UserController is created for |
| 33 // each of the Users's in the UserManager (including one for guest), and the | 33 // each of the Users's in the UserManager (including one for guest), and the |
| 34 // window manager is then told to show the windows. If the user clicks on the | 34 // window manager is then told to show the windows. If the user clicks on the |
| 35 // guest entry the WizardWindow is swapped in. | 35 // guest entry the WizardWindow is swapped in. |
| 36 // | 36 // |
| 37 // To use ExistingUserController create an instance of it and invoke Init. | 37 // To use ExistingUserController create an instance of it and invoke Init. |
| 38 // | 38 // |
| 39 // ExistingUserController maintains it's own life cycle and deletes itself when | 39 // ExistingUserController maintains it's own life cycle and deletes itself when |
| 40 // the user logs in (or chooses to see other settings). | 40 // the user logs in (or chooses to see other settings). |
| 41 class ExistingUserController : public WmMessageListener::Observer, | 41 class ExistingUserController : public WmMessageListener::Observer, |
| 42 public UserController::Delegate, | 42 public UserController::Delegate, |
| 43 public LoginStatusConsumer, | 43 public LoginStatusConsumer, |
| 44 public InfoBubbleDelegate, | 44 public MessageBubbleDelegate, |
| 45 public CaptchaView::Delegate, | 45 public CaptchaView::Delegate, |
| 46 public PasswordChangedView::Delegate { | 46 public PasswordChangedView::Delegate { |
| 47 public: | 47 public: |
| 48 // Initializes views for known users. |background_bounds| determines the | 48 // Initializes views for known users. |background_bounds| determines the |
| 49 // bounds of background view. | 49 // bounds of background view. |
| 50 ExistingUserController(const std::vector<UserManager::User>& users, | 50 ExistingUserController(const std::vector<UserManager::User>& users, |
| 51 const gfx::Rect& background_bounds); | 51 const gfx::Rect& background_bounds); |
| 52 | 52 |
| 53 // Creates and shows the appropriate set of windows. | 53 // Creates and shows the appropriate set of windows. |
| 54 void Init(); | 54 void Init(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 virtual void OnPasswordChangeDetected( | 93 virtual void OnPasswordChangeDetected( |
| 94 const GaiaAuthConsumer::ClientLoginResult& credentials); | 94 const GaiaAuthConsumer::ClientLoginResult& credentials); |
| 95 | 95 |
| 96 // Overridden from views::InfoBubbleDelegate. | 96 // Overridden from views::InfoBubbleDelegate. |
| 97 virtual void InfoBubbleClosing(InfoBubble* info_bubble, | 97 virtual void InfoBubbleClosing(InfoBubble* info_bubble, |
| 98 bool closed_by_escape) { | 98 bool closed_by_escape) { |
| 99 bubble_ = NULL; | 99 bubble_ = NULL; |
| 100 } | 100 } |
| 101 virtual bool CloseOnEscape() { return true; } | 101 virtual bool CloseOnEscape() { return true; } |
| 102 virtual bool FadeInOnShow() { return false; } | 102 virtual bool FadeInOnShow() { return false; } |
| 103 virtual void OnHelpLinkActivated(); |
| 103 | 104 |
| 104 // CaptchaView::Delegate: | 105 // CaptchaView::Delegate: |
| 105 virtual void OnCaptchaEntered(const std::string& captcha); | 106 virtual void OnCaptchaEntered(const std::string& captcha); |
| 106 | 107 |
| 107 // PasswordChangedView::Delegate: | 108 // PasswordChangedView::Delegate: |
| 108 virtual void RecoverEncryptedData(const std::string& old_password); | 109 virtual void RecoverEncryptedData(const std::string& old_password); |
| 109 virtual void ResyncEncryptedData(); | 110 virtual void ResyncEncryptedData(); |
| 110 | 111 |
| 111 // Adds start url to command line. | 112 // Adds start url to command line. |
| 112 void AppendStartUrlToCmdline(); | 113 void AppendStartUrlToCmdline(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 134 | 135 |
| 135 // The set of UserControllers. | 136 // The set of UserControllers. |
| 136 std::vector<UserController*> controllers_; | 137 std::vector<UserController*> controllers_; |
| 137 | 138 |
| 138 // Used for logging in. | 139 // Used for logging in. |
| 139 scoped_refptr<Authenticator> authenticator_; | 140 scoped_refptr<Authenticator> authenticator_; |
| 140 | 141 |
| 141 // Index of selected view (user). | 142 // Index of selected view (user). |
| 142 size_t selected_view_index_; | 143 size_t selected_view_index_; |
| 143 | 144 |
| 145 // Number of login attempts. Used to show help link when > 1 unsuccessful |
| 146 // logins for the same user. |
| 147 size_t num_login_attempts_; |
| 148 |
| 144 // See comment in ProcessWmMessage. | 149 // See comment in ProcessWmMessage. |
| 145 base::OneShotTimer<ExistingUserController> delete_timer_; | 150 base::OneShotTimer<ExistingUserController> delete_timer_; |
| 146 | 151 |
| 147 // Pointer to the instance that was scheduled to be deleted soon or NULL | 152 // Pointer to the instance that was scheduled to be deleted soon or NULL |
| 148 // if there is no such instance. | 153 // if there is no such instance. |
| 149 static ExistingUserController* delete_scheduled_instance_; | 154 static ExistingUserController* delete_scheduled_instance_; |
| 150 | 155 |
| 151 // Pointer to shown message bubble. We don't need to delete it because | 156 // Pointer to shown message bubble. We don't need to delete it because |
| 152 // it will be deleted on bubble closing. | 157 // it will be deleted on bubble closing. |
| 153 MessageBubble* bubble_; | 158 MessageBubble* bubble_; |
| 154 | 159 |
| 155 // Token representing the specific CAPTCHA challenge. | 160 // Token representing the specific CAPTCHA challenge. |
| 156 std::string login_token_; | 161 std::string login_token_; |
| 157 | 162 |
| 158 // String entered by the user as an answer to a CAPTCHA challenge. | 163 // String entered by the user as an answer to a CAPTCHA challenge. |
| 159 std::string login_captcha_; | 164 std::string login_captcha_; |
| 160 | 165 |
| 161 // URL that will be opened on browser startup. | 166 // URL that will be opened on browser startup. |
| 162 GURL start_url_; | 167 GURL start_url_; |
| 163 | 168 |
| 164 // Cached credentials data when password change is detected. | 169 // Cached credentials data when password change is detected. |
| 165 GaiaAuthConsumer::ClientLoginResult cached_credentials_; | 170 GaiaAuthConsumer::ClientLoginResult cached_credentials_; |
| 166 | 171 |
| 167 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); | 172 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); |
| 168 }; | 173 }; |
| 169 | 174 |
| 170 } // namespace chromeos | 175 } // namespace chromeos |
| 171 | 176 |
| 172 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 177 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
| OLD | NEW |