| 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 #include "chrome/browser/chromeos/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 virtual scoped_refptr<Authenticator> CreateAuthenticator( | 225 virtual scoped_refptr<Authenticator> CreateAuthenticator( |
| 226 LoginStatusConsumer* consumer) OVERRIDE; | 226 LoginStatusConsumer* consumer) OVERRIDE; |
| 227 virtual void PrewarmAuthentication() OVERRIDE; | 227 virtual void PrewarmAuthentication() OVERRIDE; |
| 228 virtual void RestoreAuthenticationSession(Profile* profile) OVERRIDE; | 228 virtual void RestoreAuthenticationSession(Profile* profile) OVERRIDE; |
| 229 virtual void StartTokenServices(Profile* user_profile) OVERRIDE; | 229 virtual void StartTokenServices(Profile* user_profile) OVERRIDE; |
| 230 virtual void StartSignedInServices( | 230 virtual void StartSignedInServices( |
| 231 Profile* profile, | 231 Profile* profile, |
| 232 const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE; | 232 const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE; |
| 233 virtual void StopBackgroundFetchers() OVERRIDE; | 233 virtual void StopBackgroundFetchers() OVERRIDE; |
| 234 virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE; | 234 virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE; |
| 235 virtual void CompleteProfileCreate(Profile* user_profile) OVERRIDE; | |
| 236 | 235 |
| 237 // OAuth1TokenFetcher::Delegate overrides. | 236 // OAuth1TokenFetcher::Delegate overrides. |
| 238 void OnOAuth1AccessTokenAvailable(const std::string& token, | 237 void OnOAuth1AccessTokenAvailable(const std::string& token, |
| 239 const std::string& secret) OVERRIDE; | 238 const std::string& secret) OVERRIDE; |
| 240 void OnOAuth1AccessTokenFetchFailed() OVERRIDE; | 239 void OnOAuth1AccessTokenFetchFailed() OVERRIDE; |
| 241 | 240 |
| 242 // OAuthLoginVerifier::Delegate overrides. | 241 // OAuthLoginVerifier::Delegate overrides. |
| 243 virtual void OnOAuthVerificationSucceeded(const std::string& user_name, | 242 virtual void OnOAuthVerificationSucceeded(const std::string& user_name, |
| 244 const std::string& sid, | 243 const std::string& sid, |
| 245 const std::string& lsid, | 244 const std::string& lsid, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // Check user's profile for kApplicationLocale setting. | 298 // Check user's profile for kApplicationLocale setting. |
| 300 void RespectLocalePreference(Profile* pref); | 299 void RespectLocalePreference(Profile* pref); |
| 301 | 300 |
| 302 // Initializes basic preferences for newly created profile. | 301 // Initializes basic preferences for newly created profile. |
| 303 void InitProfilePreferences(Profile* user_profile); | 302 void InitProfilePreferences(Profile* user_profile); |
| 304 | 303 |
| 305 // Callback for asynchronous profile creation. | 304 // Callback for asynchronous profile creation. |
| 306 void OnProfileCreated(Profile* profile, | 305 void OnProfileCreated(Profile* profile, |
| 307 Profile::CreateStatus status); | 306 Profile::CreateStatus status); |
| 308 | 307 |
| 308 // Callback to resume profile creation after transferring auth data from |
| 309 // the authentication profile. |
| 310 void CompleteProfileCreate(Profile* user_profile); |
| 311 |
| 309 // Finalized profile preparation. | 312 // Finalized profile preparation. |
| 310 void FinalizePrepareProfile(Profile* user_profile); | 313 void FinalizePrepareProfile(Profile* user_profile); |
| 311 | 314 |
| 312 // Restores GAIA auth cookies for the created profile. | 315 // Restores GAIA auth cookies for the created profile. |
| 313 void RestoreAuthCookies(Profile* user_profile); | 316 void RestoreAuthCookies(Profile* user_profile); |
| 314 | 317 |
| 315 // Initializes RLZ. If |disabled| is true, RLZ pings are disabled. | 318 // Initializes RLZ. If |disabled| is true, RLZ pings are disabled. |
| 316 void InitRlz(Profile* user_profile, bool disabled); | 319 void InitRlz(Profile* user_profile, bool disabled); |
| 317 | 320 |
| 318 std::string password_; | 321 std::string password_; |
| 319 bool pending_requests_; | 322 bool pending_requests_; |
| 320 bool using_oauth_; | 323 bool using_oauth_; |
| 321 // True if the authenrication profile's cookie jar should contain | 324 // True if the authentication profile's cookie jar should contain |
| 322 // authentication cookies from the authentication extension log in flow. | 325 // authentication cookies from the authentication extension log in flow. |
| 323 bool has_web_auth_cookies_; | 326 bool has_web_auth_cookies_; |
| 324 // Has to be scoped_refptr, see comment for CreateAuthenticator(...). | 327 // Has to be scoped_refptr, see comment for CreateAuthenticator(...). |
| 325 scoped_refptr<Authenticator> authenticator_; | 328 scoped_refptr<Authenticator> authenticator_; |
| 326 scoped_ptr<PolicyOAuthFetcher> policy_oauth_fetcher_; | 329 scoped_ptr<PolicyOAuthFetcher> policy_oauth_fetcher_; |
| 327 scoped_ptr<OAuth1TokenFetcher> oauth1_token_fetcher_; | 330 scoped_ptr<OAuth1TokenFetcher> oauth1_token_fetcher_; |
| 328 scoped_ptr<OAuthLoginVerifier> oauth_login_verifier_; | 331 scoped_ptr<OAuthLoginVerifier> oauth_login_verifier_; |
| 329 | 332 |
| 330 // Delegate to be fired when the profile will be prepared. | 333 // Delegate to be fired when the profile will be prepared. |
| 331 LoginUtils::Delegate* delegate_; | 334 LoginUtils::Delegate* delegate_; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 if (network_configuration_updater) | 518 if (network_configuration_updater) |
| 516 network_configuration_updater->OnUserPolicyInitialized(); | 519 network_configuration_updater->OnUserPolicyInitialized(); |
| 517 RespectLocalePreference(user_profile); | 520 RespectLocalePreference(user_profile); |
| 518 } | 521 } |
| 519 | 522 |
| 520 void LoginUtilsImpl::OnProfileCreated( | 523 void LoginUtilsImpl::OnProfileCreated( |
| 521 Profile* user_profile, | 524 Profile* user_profile, |
| 522 Profile::CreateStatus status) { | 525 Profile::CreateStatus status) { |
| 523 CHECK(user_profile); | 526 CHECK(user_profile); |
| 524 | 527 |
| 525 if (delegate_) | |
| 526 delegate_->OnProfileCreated(user_profile); | |
| 527 | |
| 528 switch (status) { | 528 switch (status) { |
| 529 case Profile::CREATE_STATUS_INITIALIZED: | 529 case Profile::CREATE_STATUS_INITIALIZED: |
| 530 break; | 530 break; |
| 531 case Profile::CREATE_STATUS_CREATED: { | 531 case Profile::CREATE_STATUS_CREATED: { |
| 532 InitProfilePreferences(user_profile); | 532 InitProfilePreferences(user_profile); |
| 533 return; | 533 return; |
| 534 } | 534 } |
| 535 case Profile::CREATE_STATUS_FAIL: | 535 case Profile::CREATE_STATUS_FAIL: |
| 536 default: | 536 default: |
| 537 NOTREACHED(); | 537 NOTREACHED(); |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 bool LoginUtils::IsWhitelisted(const std::string& username) { | 1251 bool LoginUtils::IsWhitelisted(const std::string& username) { |
| 1252 CrosSettings* cros_settings = CrosSettings::Get(); | 1252 CrosSettings* cros_settings = CrosSettings::Get(); |
| 1253 bool allow_new_user = false; | 1253 bool allow_new_user = false; |
| 1254 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 1254 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 1255 if (allow_new_user) | 1255 if (allow_new_user) |
| 1256 return true; | 1256 return true; |
| 1257 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); | 1257 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 } // namespace chromeos | 1260 } // namespace chromeos |
| OLD | NEW |