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/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "base/timer.h" | 15 #include "base/timer.h" |
16 #include "chrome/browser/chromeos/login/background_view.h" | 16 #include "chrome/browser/chromeos/login/background_view.h" |
17 #include "chrome/browser/chromeos/login/captcha_view.h" | 17 #include "chrome/browser/chromeos/login/captcha_view.h" |
18 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 18 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
19 #include "chrome/browser/chromeos/login/message_bubble.h" | 19 #include "chrome/browser/chromeos/login/message_bubble.h" |
20 #include "chrome/browser/chromeos/login/password_changed_view.h" | 20 #include "chrome/browser/chromeos/login/password_changed_view.h" |
21 #include "chrome/browser/chromeos/login/user_controller.h" | 21 #include "chrome/browser/chromeos/login/user_controller.h" |
22 #include "chrome/browser/chromeos/login/user_manager.h" | 22 #include "chrome/browser/chromeos/login/user_manager.h" |
| 23 #include "chrome/browser/chromeos/login/signed_settings_helper.h" |
23 #include "chrome/browser/chromeos/wm_message_listener.h" | 24 #include "chrome/browser/chromeos/wm_message_listener.h" |
24 #include "chrome/common/net/gaia/gaia_auth_consumer.h" | 25 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
25 #include "chrome/common/net/gaia/google_service_auth_error.h" | 26 #include "chrome/common/net/gaia/google_service_auth_error.h" |
26 #include "gfx/size.h" | 27 #include "gfx/size.h" |
27 | 28 |
28 namespace chromeos { | 29 namespace chromeos { |
29 | 30 |
30 class Authenticator; | 31 class Authenticator; |
31 class HelpAppLauncher; | 32 class HelpAppLauncher; |
32 class MessageBubble; | 33 class MessageBubble; |
33 | 34 |
34 // ExistingUserController is used to handle login when someone has already | 35 // ExistingUserController is used to handle login when someone has already |
35 // logged into the machine. When Init is invoked a UserController is created for | 36 // logged into the machine. When Init is invoked a UserController is created for |
36 // each of the Users's in the UserManager (including one for guest), and the | 37 // each of the Users's in the UserManager (including one for guest), and the |
37 // window manager is then told to show the windows. If the user clicks on the | 38 // window manager is then told to show the windows. If the user clicks on the |
38 // guest entry the WizardWindow is swapped in. | 39 // guest entry the WizardWindow is swapped in. |
39 // | 40 // |
40 // To use ExistingUserController create an instance of it and invoke Init. | 41 // To use ExistingUserController create an instance of it and invoke Init. |
41 // | 42 // |
42 // ExistingUserController maintains it's own life cycle and deletes itself when | 43 // ExistingUserController maintains it's own life cycle and deletes itself when |
43 // the user logs in (or chooses to see other settings). | 44 // the user logs in (or chooses to see other settings). |
44 class ExistingUserController : public WmMessageListener::Observer, | 45 class ExistingUserController : public WmMessageListener::Observer, |
45 public UserController::Delegate, | 46 public UserController::Delegate, |
46 public BackgroundView::Delegate, | 47 public BackgroundView::Delegate, |
47 public LoginStatusConsumer, | 48 public LoginStatusConsumer, |
48 public MessageBubbleDelegate, | 49 public MessageBubbleDelegate, |
49 public CaptchaView::Delegate, | 50 public CaptchaView::Delegate, |
50 public PasswordChangedView::Delegate { | 51 public PasswordChangedView::Delegate, |
| 52 public SignedSettingsHelper::Callback { |
51 public: | 53 public: |
52 // Initializes views for known users. |background_bounds| determines the | 54 // Initializes views for known users. |background_bounds| determines the |
53 // bounds of background view. | 55 // bounds of background view. |
54 ExistingUserController(const std::vector<UserManager::User>& users, | 56 ExistingUserController(const std::vector<UserManager::User>& users, |
55 const gfx::Rect& background_bounds); | 57 const gfx::Rect& background_bounds); |
56 | 58 |
57 // Creates and shows the appropriate set of windows. | 59 // Creates and shows the appropriate set of windows. |
58 void Init(); | 60 void Init(); |
59 | 61 |
60 // Takes ownership of the specified background widget and view. | 62 // Takes ownership of the specified background widget and view. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 virtual bool FadeInOnShow() { return false; } | 111 virtual bool FadeInOnShow() { return false; } |
110 virtual void OnHelpLinkActivated(); | 112 virtual void OnHelpLinkActivated(); |
111 | 113 |
112 // CaptchaView::Delegate: | 114 // CaptchaView::Delegate: |
113 virtual void OnCaptchaEntered(const std::string& captcha); | 115 virtual void OnCaptchaEntered(const std::string& captcha); |
114 | 116 |
115 // PasswordChangedView::Delegate: | 117 // PasswordChangedView::Delegate: |
116 virtual void RecoverEncryptedData(const std::string& old_password); | 118 virtual void RecoverEncryptedData(const std::string& old_password); |
117 virtual void ResyncEncryptedData(); | 119 virtual void ResyncEncryptedData(); |
118 | 120 |
| 121 // SignedSettingsHelper::Callback |
| 122 virtual void OnCheckWhiteListCompleted(bool success, |
| 123 const std::string& email); |
| 124 |
119 // Adds start url to command line. | 125 // Adds start url to command line. |
120 void AppendStartUrlToCmdline(); | 126 void AppendStartUrlToCmdline(); |
121 | 127 |
122 // Clears existing captcha state; | 128 // Clears existing captcha state; |
123 void ClearCaptchaState(); | 129 void ClearCaptchaState(); |
124 | 130 |
125 // Returns corresponding native window. | 131 // Returns corresponding native window. |
126 gfx::NativeWindow GetNativeWindow() const; | 132 gfx::NativeWindow GetNativeWindow() const; |
127 | 133 |
128 // Show error message. |error_id| error message ID in resources. | 134 // Show error message. |error_id| error message ID in resources. |
129 // If |details| string is not empty, it specify additional error text | 135 // If |details| string is not empty, it specify additional error text |
130 // provided by authenticator, it is not localized. | 136 // provided by authenticator, it is not localized. |
131 void ShowError(int error_id, const std::string& details); | 137 void ShowError(int error_id, const std::string& details); |
132 | 138 |
133 // Send message to window manager to enable/disable click on other windows. | 139 // Send message to window manager to enable/disable click on other windows. |
134 void SendSetLoginState(bool is_login); | 140 void SendSetLoginState(bool is_login); |
135 | 141 |
| 142 // Starts authentication. |
| 143 void StartAuthentication(); |
| 144 |
136 // Bounds of the background window. | 145 // Bounds of the background window. |
137 const gfx::Rect background_bounds_; | 146 const gfx::Rect background_bounds_; |
138 | 147 |
139 // Background window/view. | 148 // Background window/view. |
140 views::Widget* background_window_; | 149 views::Widget* background_window_; |
141 BackgroundView* background_view_; | 150 BackgroundView* background_view_; |
142 | 151 |
143 // The set of UserControllers. | 152 // The set of UserControllers. |
144 std::vector<UserController*> controllers_; | 153 std::vector<UserController*> controllers_; |
145 | 154 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Represents last error that was encountered when communicating to signin | 188 // Represents last error that was encountered when communicating to signin |
180 // server. GoogleServiceAuthError::NONE if none. | 189 // server. GoogleServiceAuthError::NONE if none. |
181 GoogleServiceAuthError last_login_error_; | 190 GoogleServiceAuthError last_login_error_; |
182 | 191 |
183 // True if last login has failed with LOGIN_TIMED_OUT error. | 192 // True if last login has failed with LOGIN_TIMED_OUT error. |
184 bool login_timed_out_; | 193 bool login_timed_out_; |
185 | 194 |
186 // Help application used for help dialogs. | 195 // Help application used for help dialogs. |
187 scoped_ptr<HelpAppLauncher> help_app_; | 196 scoped_ptr<HelpAppLauncher> help_app_; |
188 | 197 |
| 198 // Password for the current login attempt. |
| 199 string16 password_; |
| 200 |
189 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); | 201 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); |
190 }; | 202 }; |
191 | 203 |
192 } // namespace chromeos | 204 } // namespace chromeos |
193 | 205 |
194 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 206 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
OLD | NEW |