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

Side by Side Diff: chrome/browser/chromeos/login/session/user_session_manager.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 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 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 if (command_line->HasSwitch(::switches::kAppModeAuthCode)) { 1211 if (command_line->HasSwitch(::switches::kAppModeAuthCode)) {
1212 user_context_.SetAuthCode(command_line->GetSwitchValueASCII( 1212 user_context_.SetAuthCode(command_line->GetSwitchValueASCII(
1213 ::switches::kAppModeAuthCode)); 1213 ::switches::kAppModeAuthCode));
1214 } 1214 }
1215 1215
1216 DCHECK(!has_auth_cookies_); 1216 DCHECK(!has_auth_cookies_);
1217 } 1217 }
1218 1218
1219 if (has_auth_cookies_) { 1219 if (has_auth_cookies_) {
1220 session_restore_strategy_ = OAuth2LoginManager::RESTORE_FROM_COOKIE_JAR; 1220 session_restore_strategy_ = OAuth2LoginManager::RESTORE_FROM_COOKIE_JAR;
1221 } else if (!user_context_.GetAuthCode().empty()) {
1222 session_restore_strategy_ = OAuth2LoginManager::RESTORE_FROM_AUTH_CODE;
1221 } else if (!user_context_.GetRefreshToken().empty()) { 1223 } else if (!user_context_.GetRefreshToken().empty()) {
1222 session_restore_strategy_ = 1224 session_restore_strategy_ =
1223 OAuth2LoginManager::RESTORE_FROM_PASSED_OAUTH2_REFRESH_TOKEN; 1225 OAuth2LoginManager::RESTORE_FROM_PASSED_OAUTH2_REFRESH_TOKEN;
1224 } else { 1226 } else {
1225 session_restore_strategy_ = 1227 session_restore_strategy_ =
1226 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN; 1228 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN;
1227 } 1229 }
1228 } 1230 }
1229 1231
1230 void UserSessionManager::RestoreAuthSessionImpl( 1232 void UserSessionManager::RestoreAuthSessionImpl(
(...skipping 27 matching lines...) Expand all
1258 // restore case when Chrome is restarting after crash or to apply custom user 1260 // restore case when Chrome is restarting after crash or to apply custom user
1259 // flags. In that case auth_request_context will be nullptr which is accepted 1261 // flags. In that case auth_request_context will be nullptr which is accepted
1260 // by RestoreSession() for session restore case. 1262 // by RestoreSession() for session restore case.
1261 if (!auth_request_context && 1263 if (!auth_request_context &&
1262 (authenticator_.get() && authenticator_->authentication_context())) { 1264 (authenticator_.get() && authenticator_->authentication_context())) {
1263 auth_request_context = 1265 auth_request_context =
1264 authenticator_->authentication_context()->GetRequestContext(); 1266 authenticator_->authentication_context()->GetRequestContext();
1265 } 1267 }
1266 login_manager->RestoreSession(auth_request_context, session_restore_strategy_, 1268 login_manager->RestoreSession(auth_request_context, session_restore_strategy_,
1267 user_context_.GetRefreshToken(), 1269 user_context_.GetRefreshToken(),
1268 user_context_.GetAccessToken()); 1270 user_context_.GetAuthCode());
1269 } 1271 }
1270 1272
1271 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) { 1273 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) {
1272 #if defined(ENABLE_RLZ) 1274 #if defined(ENABLE_RLZ)
1273 PrefService* local_state = g_browser_process->local_state(); 1275 PrefService* local_state = g_browser_process->local_state();
1274 if (disabled) { 1276 if (disabled) {
1275 // Empty brand code means an organic install (no RLZ pings are sent). 1277 // Empty brand code means an organic install (no RLZ pings are sent).
1276 google_brand::chromeos::ClearBrandForCurrentSession(); 1278 google_brand::chromeos::ClearBrandForCurrentSession();
1277 } 1279 }
1278 if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) { 1280 if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 if (is_enterprise_managed) 1659 if (is_enterprise_managed)
1658 display = USER_PODS_DISPLAY_DISABLED_MANAGED; 1660 display = USER_PODS_DISPLAY_DISABLED_MANAGED;
1659 else 1661 else
1660 display = USER_PODS_DISPLAY_DISABLED_REGULAR; 1662 display = USER_PODS_DISPLAY_DISABLED_REGULAR;
1661 } 1663 }
1662 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, 1664 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display,
1663 NUM_USER_PODS_DISPLAY); 1665 NUM_USER_PODS_DISPLAY);
1664 } 1666 }
1665 1667
1666 } // namespace chromeos 1668 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/saml/saml_browsertest.cc ('k') | chrome/browser/chromeos/login/signin/oauth2_login_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698