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

Side by Side Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 614973002: Extract LoginPerformer to chromeos/auth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/session/user_session_manager.h" 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 CrosSettings::Get()->GetBoolean( 773 CrosSettings::Get()->GetBoolean(
774 kAccountsPrefTransferSAMLCookies, 774 kAccountsPrefTransferSAMLCookies,
775 &transfer_saml_auth_cookies_on_subsequent_login); 775 &transfer_saml_auth_cookies_on_subsequent_login);
776 } 776 }
777 777
778 // Transfers authentication-related data from the profile that was used for 778 // Transfers authentication-related data from the profile that was used for
779 // authentication to the user's profile. The proxy authentication state is 779 // authentication to the user's profile. The proxy authentication state is
780 // transferred unconditionally. If the user authenticated via an auth 780 // transferred unconditionally. If the user authenticated via an auth
781 // extension, authentication cookies and channel IDs will be transferred as 781 // extension, authentication cookies and channel IDs will be transferred as
782 // well when the user's cookie jar is empty. If the cookie jar is not empty, 782 // well when the user's cookie jar is empty. If the cookie jar is not empty,
783 // the authentication states in the login profile and the user's profile 783 // the authentication states in the browser context and the user's profile
784 // must be merged using /MergeSession instead. Authentication cookies set by 784 // must be merged using /MergeSession instead. Authentication cookies set by
785 // a SAML IdP will also be transferred when the user's cookie jar is not 785 // a SAML IdP will also be transferred when the user's cookie jar is not
786 // empty if |transfer_saml_auth_cookies_on_subsequent_login| is true. 786 // empty if |transfer_saml_auth_cookies_on_subsequent_login| is true.
787 const bool transfer_auth_cookies_and_channel_ids_on_first_login = 787 const bool transfer_auth_cookies_and_channel_ids_on_first_login =
788 has_auth_cookies_; 788 has_auth_cookies_;
789 ProfileAuthData::Transfer( 789 ProfileAuthData::Transfer(
790 authenticator_->authentication_profile(), 790 authenticator_->authentication_context(),
791 profile, 791 profile,
792 transfer_auth_cookies_and_channel_ids_on_first_login, 792 transfer_auth_cookies_and_channel_ids_on_first_login,
793 transfer_saml_auth_cookies_on_subsequent_login, 793 transfer_saml_auth_cookies_on_subsequent_login,
794 base::Bind(&UserSessionManager::CompleteProfileCreateAfterAuthTransfer, 794 base::Bind(&UserSessionManager::CompleteProfileCreateAfterAuthTransfer,
795 AsWeakPtr(), 795 AsWeakPtr(),
796 profile)); 796 profile));
797 return; 797 return;
798 } 798 }
799 799
800 FinalizePrepareProfile(profile); 800 FinalizePrepareProfile(profile);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 if (has_auth_cookies_) { 894 if (has_auth_cookies_) {
895 session_restore_strategy_ = OAuth2LoginManager::RESTORE_FROM_COOKIE_JAR; 895 session_restore_strategy_ = OAuth2LoginManager::RESTORE_FROM_COOKIE_JAR;
896 } else if (!user_context_.GetAuthCode().empty()) { 896 } else if (!user_context_.GetAuthCode().empty()) {
897 session_restore_strategy_ = OAuth2LoginManager::RESTORE_FROM_AUTH_CODE; 897 session_restore_strategy_ = OAuth2LoginManager::RESTORE_FROM_AUTH_CODE;
898 } else { 898 } else {
899 session_restore_strategy_ = 899 session_restore_strategy_ =
900 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN; 900 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN;
901 } 901 }
902 } 902 }
903 903
904 void UserSessionManager::RestoreAuthSessionImpl(Profile* profile, 904 void UserSessionManager::RestoreAuthSessionImpl(
905 bool restore_from_auth_cookies) { 905 Profile* profile,
906 CHECK((authenticator_.get() && authenticator_->authentication_profile()) || 906 bool restore_from_auth_cookies) {
907 CHECK((authenticator_.get() && authenticator_->authentication_context()) ||
907 !restore_from_auth_cookies); 908 !restore_from_auth_cookies);
908 909
909 if (chrome::IsRunningInForcedAppMode() || 910 if (chrome::IsRunningInForcedAppMode() ||
910 CommandLine::ForCurrentProcess()->HasSwitch( 911 CommandLine::ForCurrentProcess()->HasSwitch(
911 chromeos::switches::kDisableGaiaServices)) { 912 chromeos::switches::kDisableGaiaServices)) {
912 return; 913 return;
913 } 914 }
914 915
915 exit_after_session_restore_ = false; 916 exit_after_session_restore_ = false;
916 917
917 // Remove legacy OAuth1 token if we have one. If it's valid, we should already 918 // Remove legacy OAuth1 token if we have one. If it's valid, we should already
918 // have OAuth2 refresh token in OAuth2TokenService that could be used to 919 // have OAuth2 refresh token in OAuth2TokenService that could be used to
919 // retrieve all other tokens and user_context. 920 // retrieve all other tokens and user_context.
920 OAuth2LoginManager* login_manager = 921 OAuth2LoginManager* login_manager =
921 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(profile); 922 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(profile);
922 login_manager->AddObserver(this); 923 login_manager->AddObserver(this);
923 login_manager->RestoreSession( 924 login_manager->RestoreSession(
924 authenticator_.get() && authenticator_->authentication_profile() 925 authenticator_.get() && authenticator_->authentication_context()
925 ? authenticator_->authentication_profile()->GetRequestContext() 926 ? authenticator_->authentication_context()->GetRequestContext()
926 : NULL, 927 : NULL,
927 session_restore_strategy_, 928 session_restore_strategy_,
928 oauth2_refresh_token_, 929 oauth2_refresh_token_,
929 user_context_.GetAuthCode()); 930 user_context_.GetAuthCode());
930 } 931 }
931 932
932 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) { 933 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) {
933 #if defined(ENABLE_RLZ) 934 #if defined(ENABLE_RLZ)
934 PrefService* local_state = g_browser_process->local_state(); 935 PrefService* local_state = g_browser_process->local_state();
935 if (disabled) { 936 if (disabled) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 } 1149 }
1149 1150
1150 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { 1151 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() {
1151 if (!easy_unlock_key_manager_) 1152 if (!easy_unlock_key_manager_)
1152 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); 1153 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager);
1153 1154
1154 return easy_unlock_key_manager_.get(); 1155 return easy_unlock_key_manager_.get();
1155 } 1156 }
1156 1157
1157 } // namespace chromeos 1158 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/screens/error_screen.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698