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

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

Powered by Google App Engine
This is Rietveld 408576698