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_LOGIN_PERFORMER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/chromeos/login/authenticator.h" | 12 #include "chrome/browser/chromeos/login/authenticator.h" |
13 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 13 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
14 #include "chrome/browser/chromeos/login/online_attempt_host.h" | 14 #include "chrome/browser/chromeos/login/online_attempt_host.h" |
| 15 #include "chrome/browser/chromeos/login/user.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
18 #include "google_apis/gaia/google_service_auth_error.h" | 19 #include "google_apis/gaia/google_service_auth_error.h" |
19 | 20 |
20 namespace chromeos { | 21 namespace chromeos { |
21 | 22 |
22 // This class encapsulates sign in operations. | 23 // This class encapsulates sign in operations. |
23 // Sign in is performed in a way that offline auth is executed first. | 24 // Sign in is performed in a way that offline auth is executed first. |
24 // Once offline auth is OK - user homedir is mounted, UI is launched. | 25 // Once offline auth is OK - user homedir is mounted, UI is launched. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // This instance is owned by delegate_ till it's destroyed. | 78 // This instance is owned by delegate_ till it's destroyed. |
78 // When LP instance lives by itself it's used by ScreenLocker instance. | 79 // When LP instance lives by itself it's used by ScreenLocker instance. |
79 static LoginPerformer* default_performer() { | 80 static LoginPerformer* default_performer() { |
80 return default_performer_; | 81 return default_performer_; |
81 } | 82 } |
82 | 83 |
83 // LoginStatusConsumer implementation: | 84 // LoginStatusConsumer implementation: |
84 virtual void OnLoginFailure(const LoginFailure& error) OVERRIDE; | 85 virtual void OnLoginFailure(const LoginFailure& error) OVERRIDE; |
85 virtual void OnRetailModeLoginSuccess() OVERRIDE; | 86 virtual void OnRetailModeLoginSuccess() OVERRIDE; |
86 virtual void OnLoginSuccess( | 87 virtual void OnLoginSuccess( |
87 const std::string& username, | 88 const UserCredentials& credentials, |
88 const std::string& password, | |
89 bool pending_requests, | 89 bool pending_requests, |
90 bool using_oauth) OVERRIDE; | 90 bool using_oauth) OVERRIDE; |
91 virtual void OnOffTheRecordLoginSuccess() OVERRIDE; | 91 virtual void OnOffTheRecordLoginSuccess() OVERRIDE; |
92 virtual void OnPasswordChangeDetected() OVERRIDE; | 92 virtual void OnPasswordChangeDetected() OVERRIDE; |
93 | 93 |
94 // Performs a login for |username| and |password|. If auth_mode is | 94 // Performs a login for |credentials|. |
95 // AUTH_MODE_EXTENSION, there are no further auth checks, AUTH_MODE_INTERNAL | 95 // If auth_mode is AUTH_MODE_EXTENSION, there are no further auth checks, |
96 // will perform auth checks. | 96 // AUTH_MODE_INTERNAL will perform auth checks. |
97 void PerformLogin(const std::string& username, | 97 void PerformLogin(const UserCredentials& credentials, |
98 const std::string& password, | |
99 AuthorizationMode auth_mode); | 98 AuthorizationMode auth_mode); |
100 | 99 |
101 // Performs locally managed user creation and login. | 100 // Performs locally managed user creation and login. |
102 void CreateLocallyManagedUser(const string16& display_name, | 101 void CreateLocallyManagedUser(const string16& display_name, |
103 const std::string& password); | 102 const std::string& password); |
104 | 103 |
105 // Performs locally managed user login with a given |username| and |password|. | 104 // Performs locally managed user login with a given |username| and |password|. |
106 // Managed user creation should be done with CreateLocallyManagedUser(). | 105 // Managed user creation should be done with CreateLocallyManagedUser(). |
107 void LoginAsLocallyManagedUser(const std::string& username, | 106 void LoginAsLocallyManagedUser(const UserCredentials& credentials); |
108 const std::string& password); | |
109 | 107 |
110 // Performs retail mode login. | 108 // Performs retail mode login. |
111 void LoginRetailMode(); | 109 void LoginRetailMode(); |
112 | 110 |
113 // Performs actions to prepare guest mode login. | 111 // Performs actions to prepare guest mode login. |
114 void LoginOffTheRecord(); | 112 void LoginOffTheRecord(); |
115 | 113 |
116 // Performs a login into the public account identified by |username|. | 114 // Performs a login into the public account identified by |username|. |
117 void LoginAsPublicAccount(const std::string& username); | 115 void LoginAsPublicAccount(const std::string& username); |
118 | 116 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Used for logging in. | 189 // Used for logging in. |
192 scoped_refptr<Authenticator> authenticator_; | 190 scoped_refptr<Authenticator> authenticator_; |
193 | 191 |
194 // Used to make auxiliary online check. | 192 // Used to make auxiliary online check. |
195 OnlineAttemptHost online_attempt_host_; | 193 OnlineAttemptHost online_attempt_host_; |
196 | 194 |
197 // Represents last login failure that was encountered when communicating to | 195 // Represents last login failure that was encountered when communicating to |
198 // sign-in server. LoginFailure.LoginFailureNone() by default. | 196 // sign-in server. LoginFailure.LoginFailureNone() by default. |
199 LoginFailure last_login_failure_; | 197 LoginFailure last_login_failure_; |
200 | 198 |
201 // Username and password for the current login attempt. | 199 // User credentials for the current login attempt. |
202 std::string username_; | 200 UserCredentials credentials_; |
203 std::string password_; | |
204 | 201 |
205 // Notifications receiver. | 202 // Notifications receiver. |
206 Delegate* delegate_; | 203 Delegate* delegate_; |
207 | 204 |
208 // True if password change has been detected. | 205 // True if password change has been detected. |
209 // Once correct password is entered homedir migration is executed. | 206 // Once correct password is entered homedir migration is executed. |
210 bool password_changed_; | 207 bool password_changed_; |
211 int password_changed_callback_count_; | 208 int password_changed_callback_count_; |
212 | 209 |
213 // Used for ScreenLock notifications. | 210 // Used for ScreenLock notifications. |
(...skipping 12 matching lines...) Expand all Loading... |
226 AuthorizationMode auth_mode_; | 223 AuthorizationMode auth_mode_; |
227 | 224 |
228 base::WeakPtrFactory<LoginPerformer> weak_factory_; | 225 base::WeakPtrFactory<LoginPerformer> weak_factory_; |
229 | 226 |
230 DISALLOW_COPY_AND_ASSIGN(LoginPerformer); | 227 DISALLOW_COPY_AND_ASSIGN(LoginPerformer); |
231 }; | 228 }; |
232 | 229 |
233 } // namespace chromeos | 230 } // namespace chromeos |
234 | 231 |
235 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ | 232 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ |
OLD | NEW |