Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.h

Issue 12218078: Implement a policy to autologin a public account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits; fix lazy timer initialization Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ExistingUserControllerPublicSessionTest;
116 friend class MockLoginPerformerDelegate; 125 friend class MockLoginPerformerDelegate;
117 126
127 // Retrieve public session auto-login policy and update the timer.
128 void ConfigurePublicSessionAutoLogin();
129
130 // Trigger public session auto-login.
131 void OnPublicSessionAutoLoginTimerFire();
132
118 // LoginPerformer::Delegate implementation: 133 // LoginPerformer::Delegate implementation:
119 virtual void OnLoginFailure(const LoginFailure& error) OVERRIDE; 134 virtual void OnLoginFailure(const LoginFailure& error) OVERRIDE;
120 virtual void OnLoginSuccess( 135 virtual void OnLoginSuccess(
121 const std::string& username, 136 const std::string& username,
122 const std::string& password, 137 const std::string& password,
123 bool pending_requests, 138 bool pending_requests,
124 bool using_oauth) OVERRIDE; 139 bool using_oauth) OVERRIDE;
125 virtual void OnOffTheRecordLoginSuccess() OVERRIDE; 140 virtual void OnOffTheRecordLoginSuccess() OVERRIDE;
126 virtual void OnPasswordChangeDetected() OVERRIDE; 141 virtual void OnPasswordChangeDetected() OVERRIDE;
127 virtual void WhiteListCheckFailed(const std::string& email) OVERRIDE; 142 virtual void WhiteListCheckFailed(const std::string& email) OVERRIDE;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 std::string password, 203 std::string password,
189 LoginPerformer::AuthorizationMode auth_mode); 204 LoginPerformer::AuthorizationMode auth_mode);
190 205
191 void set_login_performer_delegate(LoginPerformer::Delegate* d) { 206 void set_login_performer_delegate(LoginPerformer::Delegate* d) {
192 login_performer_delegate_.reset(d); 207 login_performer_delegate_.reset(d);
193 } 208 }
194 209
195 // Updates the |login_display_| attached to this controller. 210 // Updates the |login_display_| attached to this controller.
196 void UpdateLoginDisplay(const UserList& users); 211 void UpdateLoginDisplay(const UserList& users);
197 212
213 // Public session auto-login timer.
214 scoped_ptr<base::OneShotTimer<ExistingUserController> > auto_login_timer_;
215
216 // Public session auto-login timeout, in milliseconds.
217 int public_session_auto_login_delay_;
218
219 // Username for public session auto-login.
220 std::string public_session_auto_login_username_;
221
198 // Used to execute login operations. 222 // Used to execute login operations.
199 scoped_ptr<LoginPerformer> login_performer_; 223 scoped_ptr<LoginPerformer> login_performer_;
200 224
201 // Delegate for login performer to be overridden by tests. 225 // Delegate for login performer to be overridden by tests.
202 // |this| is used if |login_performer_delegate_| is NULL. 226 // |this| is used if |login_performer_delegate_| is NULL.
203 scoped_ptr<LoginPerformer::Delegate> login_performer_delegate_; 227 scoped_ptr<LoginPerformer::Delegate> login_performer_delegate_;
204 228
205 // Delegate to forward all login status events to. 229 // Delegate to forward all login status events to.
206 // Tests can use this to receive login status events. 230 // Tests can use this to receive login status events.
207 LoginStatusConsumer* login_status_consumer_; 231 LoginStatusConsumer* login_status_consumer_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 std::string online_succeeded_for_; 272 std::string online_succeeded_for_;
249 273
250 // True if password has been changed for user who is completing sign in. 274 // True if password has been changed for user who is completing sign in.
251 // Set in OnLoginSuccess. Before that use LoginPerformer::password_changed(). 275 // Set in OnLoginSuccess. Before that use LoginPerformer::password_changed().
252 bool password_changed_; 276 bool password_changed_;
253 277
254 // True if auto-enrollment should be performed before starting the user's 278 // True if auto-enrollment should be performed before starting the user's
255 // session. 279 // session.
256 bool do_auto_enrollment_; 280 bool do_auto_enrollment_;
257 281
282 // Whether the sign-in UI is finished loading.
283 bool signin_screen_ready_;
284
258 // The username used for auto-enrollment, if it was triggered. 285 // The username used for auto-enrollment, if it was triggered.
259 std::string auto_enrollment_username_; 286 std::string auto_enrollment_username_;
260 287
261 // Callback to invoke to resume login, after auto-enrollment has completed. 288 // Callback to invoke to resume login, after auto-enrollment has completed.
262 base::Closure resume_login_callback_; 289 base::Closure resume_login_callback_;
263 290
264 // Time when the signin screen was first displayed. Used to measure the time 291 // Time when the signin screen was first displayed. Used to measure the time
265 // from showing the screen until a successful login is performed. 292 // from showing the screen until a successful login is performed.
266 base::Time time_init_; 293 base::Time time_init_;
267 294
268 // Timer for the interval to wait for the reboot after TPM error UI was shown. 295 // Timer for the interval to wait for the reboot after TPM error UI was shown.
269 base::OneShotTimer<ExistingUserController> reboot_timer_; 296 base::OneShotTimer<ExistingUserController> reboot_timer_;
270 297
271 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, ExistingUserLogin); 298 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, ExistingUserLogin);
272 299
273 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); 300 DISALLOW_COPY_AND_ASSIGN(ExistingUserController);
274 }; 301 };
275 302
276 } // namespace chromeos 303 } // namespace chromeos
277 304
278 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ 305 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698