OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
bartfab (slow)
2013/03/07 12:17:23
Could you #include "base/basictypes.h" here? It is
dconnelly
2013/03/07 14:45:19
Done.
| |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/timer.h" | 17 #include "base/timer.h" |
18 #include "chrome/browser/chromeos/login/login_display.h" | 18 #include "chrome/browser/chromeos/login/login_display.h" |
19 #include "chrome/browser/chromeos/login/login_performer.h" | 19 #include "chrome/browser/chromeos/login/login_performer.h" |
(...skipping 40 matching lines...) Loading... | |
60 | 60 |
61 // Tells the controller to resume a pending login. | 61 // Tells the controller to resume a pending login. |
62 void ResumeLogin(); | 62 void ResumeLogin(); |
63 | 63 |
64 // Invoked when a kiosk app launch is started. | 64 // Invoked when a kiosk app launch is started. |
65 void OnKioskAppLaunchStarted(); | 65 void OnKioskAppLaunchStarted(); |
66 | 66 |
67 // Invoked when a kiosk app launch is failed. | 67 // Invoked when a kiosk app launch is failed. |
68 void OnKioskAppLaunchFailed(); | 68 void OnKioskAppLaunchFailed(); |
69 | 69 |
70 // Start the public session auto-login timer. | |
71 void StartPublicSessionAutoLoginTimer(); | |
72 | |
73 // Stop the public session auto-login timer when a login attempt begins. | |
74 void StopPublicSessionAutoLoginTimer(); | |
75 | |
70 // LoginDisplay::Delegate: implementation | 76 // LoginDisplay::Delegate: implementation |
71 virtual void CancelPasswordChangedFlow() OVERRIDE; | 77 virtual void CancelPasswordChangedFlow() OVERRIDE; |
72 virtual void CreateAccount() OVERRIDE; | 78 virtual void CreateAccount() OVERRIDE; |
73 virtual void CreateLocallyManagedUser(const string16& display_name, | 79 virtual void CreateLocallyManagedUser(const string16& display_name, |
74 const std::string& password) OVERRIDE; | 80 const std::string& password) OVERRIDE; |
75 virtual void CompleteLogin(const std::string& username, | 81 virtual void CompleteLogin(const std::string& username, |
76 const std::string& password) OVERRIDE; | 82 const std::string& password) OVERRIDE; |
77 virtual string16 GetConnectedNetworkName() OVERRIDE; | 83 virtual string16 GetConnectedNetworkName() OVERRIDE; |
78 virtual void Login(const std::string& username, | 84 virtual void Login(const std::string& username, |
79 const std::string& password) OVERRIDE; | 85 const std::string& password) OVERRIDE; |
80 virtual void MigrateUserData(const std::string& old_password) OVERRIDE; | 86 virtual void MigrateUserData(const std::string& old_password) OVERRIDE; |
81 virtual void LoginAsRetailModeUser() OVERRIDE; | 87 virtual void LoginAsRetailModeUser() OVERRIDE; |
82 virtual void LoginAsGuest() OVERRIDE; | 88 virtual void LoginAsGuest() OVERRIDE; |
83 virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE; | 89 virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE; |
90 virtual void OnSigninScreenReady() OVERRIDE; | |
84 virtual void OnUserSelected(const std::string& username) OVERRIDE; | 91 virtual void OnUserSelected(const std::string& username) OVERRIDE; |
85 virtual void OnStartEnterpriseEnrollment() OVERRIDE; | 92 virtual void OnStartEnterpriseEnrollment() OVERRIDE; |
86 virtual void OnStartDeviceReset() OVERRIDE; | 93 virtual void OnStartDeviceReset() OVERRIDE; |
94 virtual void ResetPublicSessionAutoLoginTimer() OVERRIDE; | |
87 virtual void ResyncUserData() OVERRIDE; | 95 virtual void ResyncUserData() OVERRIDE; |
88 virtual void SetDisplayEmail(const std::string& email) OVERRIDE; | 96 virtual void SetDisplayEmail(const std::string& email) OVERRIDE; |
89 virtual void ShowWrongHWIDScreen() OVERRIDE; | 97 virtual void ShowWrongHWIDScreen() OVERRIDE; |
90 virtual void Signout() OVERRIDE; | 98 virtual void Signout() OVERRIDE; |
91 | 99 |
92 // content::NotificationObserver implementation. | 100 // content::NotificationObserver implementation. |
93 virtual void Observe(int type, | 101 virtual void Observe(int type, |
94 const content::NotificationSource& source, | 102 const content::NotificationSource& source, |
95 const content::NotificationDetails& details) OVERRIDE; | 103 const content::NotificationDetails& details) OVERRIDE; |
96 | 104 |
97 // Set a delegate that we will pass LoginStatusConsumer events to. | 105 // Set a delegate that we will pass LoginStatusConsumer events to. |
98 // Used for testing. | 106 // Used for testing. |
99 void set_login_status_consumer(LoginStatusConsumer* consumer) { | 107 void set_login_status_consumer(LoginStatusConsumer* consumer) { |
100 login_status_consumer_ = consumer; | 108 login_status_consumer_ = consumer; |
101 } | 109 } |
102 | 110 |
103 // Returns the LoginDisplay created and owned by this controller. | 111 // Returns the LoginDisplay created and owned by this controller. |
104 // Used for testing. | 112 // Used for testing. |
105 LoginDisplay* login_display() { | 113 LoginDisplay* login_display() { |
106 return login_display_.get(); | 114 return login_display_.get(); |
107 } | 115 } |
108 | 116 |
109 // Returns the LoginDisplayHost for this controller. | 117 // Returns the LoginDisplayHost for this controller. |
110 LoginDisplayHost* login_display_host() { | 118 LoginDisplayHost* login_display_host() { |
111 return host_; | 119 return host_; |
112 } | 120 } |
113 | 121 |
114 private: | 122 private: |
115 friend class ExistingUserControllerTest; | 123 friend class ExistingUserControllerTest; |
124 friend class ExistingUserControllerAutoLoginTest; | |
125 friend class ExistingUserControllerPublicSessionTest; | |
116 friend class MockLoginPerformerDelegate; | 126 friend class MockLoginPerformerDelegate; |
117 | 127 |
128 // Retrieve public session auto-login policy and update the timer. | |
129 void ConfigurePublicSessionAutoLogin(); | |
130 | |
131 // Trigger public session auto-login. | |
132 void OnPublicSessionAutoLoginTimerFire(); | |
133 | |
118 // LoginPerformer::Delegate implementation: | 134 // LoginPerformer::Delegate implementation: |
119 virtual void OnLoginFailure(const LoginFailure& error) OVERRIDE; | 135 virtual void OnLoginFailure(const LoginFailure& error) OVERRIDE; |
120 virtual void OnLoginSuccess( | 136 virtual void OnLoginSuccess( |
121 const std::string& username, | 137 const std::string& username, |
122 const std::string& password, | 138 const std::string& password, |
123 bool pending_requests, | 139 bool pending_requests, |
124 bool using_oauth) OVERRIDE; | 140 bool using_oauth) OVERRIDE; |
125 virtual void OnOffTheRecordLoginSuccess() OVERRIDE; | 141 virtual void OnOffTheRecordLoginSuccess() OVERRIDE; |
126 virtual void OnPasswordChangeDetected() OVERRIDE; | 142 virtual void OnPasswordChangeDetected() OVERRIDE; |
127 virtual void WhiteListCheckFailed(const std::string& email) OVERRIDE; | 143 virtual void WhiteListCheckFailed(const std::string& email) OVERRIDE; |
(...skipping 60 matching lines...) Loading... | |
188 std::string password, | 204 std::string password, |
189 LoginPerformer::AuthorizationMode auth_mode); | 205 LoginPerformer::AuthorizationMode auth_mode); |
190 | 206 |
191 void set_login_performer_delegate(LoginPerformer::Delegate* d) { | 207 void set_login_performer_delegate(LoginPerformer::Delegate* d) { |
192 login_performer_delegate_.reset(d); | 208 login_performer_delegate_.reset(d); |
193 } | 209 } |
194 | 210 |
195 // Updates the |login_display_| attached to this controller. | 211 // Updates the |login_display_| attached to this controller. |
196 void UpdateLoginDisplay(const UserList& users); | 212 void UpdateLoginDisplay(const UserList& users); |
197 | 213 |
214 // Public session auto-login timer. | |
215 scoped_ptr<base::OneShotTimer<ExistingUserController> > auto_login_timer_; | |
216 | |
217 // Public session auto-login timeout, in milliseconds. | |
218 int public_session_auto_login_delay_; | |
219 | |
220 // Username for public session auto-login. | |
221 std::string public_session_auto_login_username_; | |
222 | |
198 // Used to execute login operations. | 223 // Used to execute login operations. |
199 scoped_ptr<LoginPerformer> login_performer_; | 224 scoped_ptr<LoginPerformer> login_performer_; |
200 | 225 |
201 // Delegate for login performer to be overridden by tests. | 226 // Delegate for login performer to be overridden by tests. |
202 // |this| is used if |login_performer_delegate_| is NULL. | 227 // |this| is used if |login_performer_delegate_| is NULL. |
203 scoped_ptr<LoginPerformer::Delegate> login_performer_delegate_; | 228 scoped_ptr<LoginPerformer::Delegate> login_performer_delegate_; |
204 | 229 |
205 // Delegate to forward all login status events to. | 230 // Delegate to forward all login status events to. |
206 // Tests can use this to receive login status events. | 231 // Tests can use this to receive login status events. |
207 LoginStatusConsumer* login_status_consumer_; | 232 LoginStatusConsumer* login_status_consumer_; |
(...skipping 40 matching lines...) Loading... | |
248 std::string online_succeeded_for_; | 273 std::string online_succeeded_for_; |
249 | 274 |
250 // True if password has been changed for user who is completing sign in. | 275 // True if password has been changed for user who is completing sign in. |
251 // Set in OnLoginSuccess. Before that use LoginPerformer::password_changed(). | 276 // Set in OnLoginSuccess. Before that use LoginPerformer::password_changed(). |
252 bool password_changed_; | 277 bool password_changed_; |
253 | 278 |
254 // True if auto-enrollment should be performed before starting the user's | 279 // True if auto-enrollment should be performed before starting the user's |
255 // session. | 280 // session. |
256 bool do_auto_enrollment_; | 281 bool do_auto_enrollment_; |
257 | 282 |
283 // Whether the sign-in UI is finished loading. | |
284 bool signin_screen_ready_; | |
285 | |
258 // The username used for auto-enrollment, if it was triggered. | 286 // The username used for auto-enrollment, if it was triggered. |
259 std::string auto_enrollment_username_; | 287 std::string auto_enrollment_username_; |
260 | 288 |
261 // Callback to invoke to resume login, after auto-enrollment has completed. | 289 // Callback to invoke to resume login, after auto-enrollment has completed. |
262 base::Closure resume_login_callback_; | 290 base::Closure resume_login_callback_; |
263 | 291 |
264 // Time when the signin screen was first displayed. Used to measure the time | 292 // Time when the signin screen was first displayed. Used to measure the time |
265 // from showing the screen until a successful login is performed. | 293 // from showing the screen until a successful login is performed. |
266 base::Time time_init_; | 294 base::Time time_init_; |
267 | 295 |
268 // Timer for the interval to wait for the reboot after TPM error UI was shown. | 296 // Timer for the interval to wait for the reboot after TPM error UI was shown. |
269 base::OneShotTimer<ExistingUserController> reboot_timer_; | 297 base::OneShotTimer<ExistingUserController> reboot_timer_; |
270 | 298 |
271 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, ExistingUserLogin); | 299 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, ExistingUserLogin); |
272 | 300 |
273 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); | 301 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); |
274 }; | 302 }; |
275 | 303 |
276 } // namespace chromeos | 304 } // namespace chromeos |
277 | 305 |
278 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 306 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
OLD | NEW |