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

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 12340017: Revert 183647 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 years, 10 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 #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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 virtual void SetFirstLoginPrefs(PrefService* prefs) OVERRIDE; 220 virtual void SetFirstLoginPrefs(PrefService* prefs) OVERRIDE;
221 virtual scoped_refptr<Authenticator> CreateAuthenticator( 221 virtual scoped_refptr<Authenticator> CreateAuthenticator(
222 LoginStatusConsumer* consumer) OVERRIDE; 222 LoginStatusConsumer* consumer) OVERRIDE;
223 virtual void PrewarmAuthentication() OVERRIDE; 223 virtual void PrewarmAuthentication() OVERRIDE;
224 virtual void RestoreAuthenticationSession(Profile* profile) OVERRIDE; 224 virtual void RestoreAuthenticationSession(Profile* profile) OVERRIDE;
225 virtual void StopBackgroundFetchers() OVERRIDE; 225 virtual void StopBackgroundFetchers() OVERRIDE;
226 virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE; 226 virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE;
227 virtual void CompleteProfileCreate(Profile* user_profile) OVERRIDE; 227 virtual void CompleteProfileCreate(Profile* user_profile) OVERRIDE;
228 228
229 // OAuthLoginManager::Delegate overrides. 229 // OAuthLoginManager::Delegate overrides.
230 virtual void OnCompletedMergeSession() OVERRIDE;
231 virtual void OnCompletedAuthentication(Profile* user_profile) OVERRIDE; 230 virtual void OnCompletedAuthentication(Profile* user_profile) OVERRIDE;
232 virtual void OnFoundStoredTokens() OVERRIDE; 231 virtual void OnFoundStoredTokens() OVERRIDE;
233 232
234 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides. 233 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides.
235 virtual void OnConnectionTypeChanged( 234 virtual void OnConnectionTypeChanged(
236 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; 235 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
237 236
238 // content::NotificationObserver overrides. 237 // content::NotificationObserver overrides.
239 virtual void Observe(int type, 238 virtual void Observe(int type,
240 const content::NotificationSource& source, 239 const content::NotificationSource& source,
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } 512 }
514 513
515 void LoginUtilsImpl::CompleteProfileCreate(Profile* user_profile) { 514 void LoginUtilsImpl::CompleteProfileCreate(Profile* user_profile) {
516 RestoreAuthSession(user_profile, has_web_auth_cookies_); 515 RestoreAuthSession(user_profile, has_web_auth_cookies_);
517 FinalizePrepareProfile(user_profile); 516 FinalizePrepareProfile(user_profile);
518 } 517 }
519 518
520 void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile, 519 void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile,
521 bool restore_from_auth_cookies) { 520 bool restore_from_auth_cookies) {
522 DCHECK(authenticator_ || !restore_from_auth_cookies); 521 DCHECK(authenticator_ || !restore_from_auth_cookies);
523 UserManager::Get()->SetMergeSessionState(
524 UserManager::MERGE_STATUS_IN_PROCESS);
525 // Remove legacy OAuth1 token if we have one. If it's valid, we should already 522 // Remove legacy OAuth1 token if we have one. If it's valid, we should already
526 // have OAuth2 refresh token in TokenService that could be used to retrieve 523 // have OAuth2 refresh token in TokenService that could be used to retrieve
527 // all other tokens and credentials. 524 // all other tokens and credentials.
528 login_manager_->RestoreSession( 525 login_manager_->RestoreSession(
529 user_profile, 526 user_profile,
530 authenticator_ ? 527 authenticator_ ?
531 authenticator_->authentication_profile()->GetRequestContext() : 528 authenticator_->authentication_profile()->GetRequestContext() :
532 NULL, 529 NULL,
533 restore_from_auth_cookies); 530 restore_from_auth_cookies);
534 } 531 }
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 } 947 }
951 948
952 void LoginUtilsImpl::StopBackgroundFetchers() { 949 void LoginUtilsImpl::StopBackgroundFetchers() {
953 login_manager_.reset(); 950 login_manager_.reset();
954 } 951 }
955 952
956 void LoginUtilsImpl::OnCompletedAuthentication(Profile* user_profile) { 953 void LoginUtilsImpl::OnCompletedAuthentication(Profile* user_profile) {
957 StartSignedInServices(user_profile); 954 StartSignedInServices(user_profile);
958 } 955 }
959 956
960 void LoginUtilsImpl::OnCompletedMergeSession() {
961 UserManager::Get()->SetMergeSessionState(UserManager::MERGE_STATUS_DONE);
962 }
963
964 void LoginUtilsImpl::OnFoundStoredTokens() { 957 void LoginUtilsImpl::OnFoundStoredTokens() {
965 // We don't need authenticator instance any more since its cookie jar 958 // We don't need authenticator instance any more since its cookie jar
966 // is not going to needed to mint OAuth tokens. Reset it so that 959 // is not going to needed to mint OAuth tokens. Reset it so that
967 // ScreenLocker would create a separate instance. 960 // ScreenLocker would create a separate instance.
968 authenticator_ = NULL; 961 authenticator_ = NULL;
969 } 962 }
970 963
971 void LoginUtilsImpl::OnConnectionTypeChanged( 964 void LoginUtilsImpl::OnConnectionTypeChanged(
972 net::NetworkChangeNotifier::ConnectionType type) { 965 net::NetworkChangeNotifier::ConnectionType type) {
973 if (!login_manager_.get()) 966 if (!login_manager_.get())
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 bool LoginUtils::IsWhitelisted(const std::string& username) { 1013 bool LoginUtils::IsWhitelisted(const std::string& username) {
1021 CrosSettings* cros_settings = CrosSettings::Get(); 1014 CrosSettings* cros_settings = CrosSettings::Get();
1022 bool allow_new_user = false; 1015 bool allow_new_user = false;
1023 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 1016 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
1024 if (allow_new_user) 1017 if (allow_new_user)
1025 return true; 1018 return true;
1026 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); 1019 return cros_settings->FindEmailInList(kAccountsPrefUsers, username);
1027 } 1020 }
1028 1021
1029 } // namespace chromeos 1022 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/chromeos/login/merge_session_load_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698