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

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

Issue 1102863002: Revert of Fetch OAuth2 tokens prior to profile creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 (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/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/browser_process_platform_part.h" 23 #include "chrome/browser/browser_process_platform_part.h"
24 #include "chrome/browser/chrome_notification_types.h" 24 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/chromeos/boot_times_recorder.h" 25 #include "chrome/browser/chromeos/boot_times_recorder.h"
26 #include "chrome/browser/chromeos/customization/customization_document.h" 26 #include "chrome/browser/chromeos/customization/customization_document.h"
27 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" 27 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h"
28 #include "chrome/browser/chromeos/login/easy_unlock/bootstrap_user_context_initi alizer.h" 28 #include "chrome/browser/chromeos/login/easy_unlock/bootstrap_user_context_initi alizer.h"
29 #include "chrome/browser/chromeos/login/easy_unlock/bootstrap_user_flow.h" 29 #include "chrome/browser/chromeos/login/easy_unlock/bootstrap_user_flow.h"
30 #include "chrome/browser/chromeos/login/helper.h" 30 #include "chrome/browser/chromeos/login/helper.h"
31 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 31 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
32 #include "chrome/browser/chromeos/login/signin/oauth2_token_initializer.h"
33 #include "chrome/browser/chromeos/login/signin_specifics.h" 32 #include "chrome/browser/chromeos/login/signin_specifics.h"
34 #include "chrome/browser/chromeos/login/startup_utils.h" 33 #include "chrome/browser/chromeos/login/startup_utils.h"
35 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 34 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
36 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 35 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
37 #include "chrome/browser/chromeos/login/user_flow.h" 36 #include "chrome/browser/chromeos/login/user_flow.h"
38 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 37 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
39 #include "chrome/browser/chromeos/login/wizard_controller.h" 38 #include "chrome/browser/chromeos/login/wizard_controller.h"
40 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 39 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
41 #include "chrome/browser/chromeos/policy/device_local_account.h" 40 #include "chrome/browser/chromeos/policy/device_local_account.h"
42 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" 41 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 589
591 StopPublicSessionAutoLoginTimer(); 590 StopPublicSessionAutoLoginTimer();
592 591
593 // Truth table of |has_auth_cookies|: 592 // Truth table of |has_auth_cookies|:
594 // Regular SAML 593 // Regular SAML
595 // /ServiceLogin T T 594 // /ServiceLogin T T
596 // /ChromeOsEmbeddedSetup F T 595 // /ChromeOsEmbeddedSetup F T
597 // Bootstrap experiment F N/A 596 // Bootstrap experiment F N/A
598 const bool has_auth_cookies = 597 const bool has_auth_cookies =
599 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && 598 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION &&
600 (user_context.GetAccessToken().empty() || 599 (user_context.GetAuthCode().empty() ||
601 user_context.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML) && 600 user_context.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML) &&
602 user_context.GetAuthFlow() != UserContext::AUTH_FLOW_EASY_BOOTSTRAP; 601 user_context.GetAuthFlow() != UserContext::AUTH_FLOW_EASY_BOOTSTRAP;
603 602
604 // LoginPerformer instance will delete itself in case of successful auth. 603 // LoginPerformer instance will delete itself in case of successful auth.
605 login_performer_->set_delegate(NULL); 604 login_performer_->set_delegate(NULL);
606 ignore_result(login_performer_.release()); 605 ignore_result(login_performer_.release());
607 606
608 UserSessionManager::StartSessionType start_session_type = 607 UserSessionManager::StartSessionType start_session_type =
609 UserAddingScreen::Get()->IsRunning() 608 UserAddingScreen::Get()->IsRunning()
610 ? UserSessionManager::SECONDARY_USER_SESSION 609 ? UserSessionManager::SECONDARY_USER_SESSION
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 if (user_context.GetAuthFlow() == UserContext::AUTH_FLOW_EASY_BOOTSTRAP) { 1115 if (user_context.GetAuthFlow() == UserContext::AUTH_FLOW_EASY_BOOTSTRAP) {
1117 bootstrap_user_context_initializer_.reset( 1116 bootstrap_user_context_initializer_.reset(
1118 new BootstrapUserContextInitializer()); 1117 new BootstrapUserContextInitializer());
1119 bootstrap_user_context_initializer_->Start( 1118 bootstrap_user_context_initializer_->Start(
1120 user_context.GetAuthCode(), 1119 user_context.GetAuthCode(),
1121 base::Bind(&ExistingUserController::OnBootstrapUserContextInitialized, 1120 base::Bind(&ExistingUserController::OnBootstrapUserContextInitialized,
1122 weak_factory_.GetWeakPtr())); 1121 weak_factory_.GetWeakPtr()));
1123 return; 1122 return;
1124 } 1123 }
1125 1124
1126 // Fetch OAuth2 tokens if we have an auth code.
1127 if (!user_context.GetAuthCode().empty()) {
1128 oauth2_token_initializer_.reset(new OAuth2TokenInitializer);
1129 oauth2_token_initializer_->Start(
1130 user_context, base::Bind(&ExistingUserController::OnOAuth2TokensFetched,
1131 weak_factory_.GetWeakPtr()));
1132 return;
1133 }
1134
1135 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); 1125 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
1136 } 1126 }
1137 1127
1138 void ExistingUserController::DoLogin(const UserContext& user_context, 1128 void ExistingUserController::DoLogin(const UserContext& user_context,
1139 const SigninSpecifics& specifics) { 1129 const SigninSpecifics& specifics) {
1140 if (is_login_in_progress_) { 1130 if (is_login_in_progress_) {
1141 // If there is another login in progress, bail out. Do not re-enable 1131 // If there is another login in progress, bail out. Do not re-enable
1142 // clicking on other windows and the status area. Do not start the 1132 // clicking on other windows and the status area. Do not start the
1143 // auto-login timer. 1133 // auto-login timer.
1144 return; 1134 return;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 // for bootstrap after the user session is started. 1192 // for bootstrap after the user session is started.
1203 ChromeUserManager::Get()->SetUserFlow( 1193 ChromeUserManager::Get()->SetUserFlow(
1204 user_context.GetUserID(), 1194 user_context.GetUserID(),
1205 new BootstrapUserFlow( 1195 new BootstrapUserFlow(
1206 user_context, 1196 user_context,
1207 bootstrap_user_context_initializer_->random_key_used())); 1197 bootstrap_user_context_initializer_->random_key_used()));
1208 1198
1209 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); 1199 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
1210 } 1200 }
1211 1201
1212 void ExistingUserController::OnOAuth2TokensFetched(
1213 bool success,
1214 const UserContext& user_context) {
1215 if (!success) {
1216 LOG(ERROR) << "OAuth2 token fetch failed.";
1217 OnAuthFailure(AuthFailure(AuthFailure::NETWORK_AUTH_FAILED));
1218 return;
1219 }
1220 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
1221 }
1222
1223 } // namespace chromeos 1202 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/existing_user_controller.h ('k') | chrome/browser/chromeos/login/saml/saml_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698