OLD | NEW |
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 Loading... |
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; | |
1223 } else if (!user_context_.GetRefreshToken().empty()) { | 1221 } else if (!user_context_.GetRefreshToken().empty()) { |
1224 session_restore_strategy_ = | 1222 session_restore_strategy_ = |
1225 OAuth2LoginManager::RESTORE_FROM_PASSED_OAUTH2_REFRESH_TOKEN; | 1223 OAuth2LoginManager::RESTORE_FROM_PASSED_OAUTH2_REFRESH_TOKEN; |
1226 } else { | 1224 } else { |
1227 session_restore_strategy_ = | 1225 session_restore_strategy_ = |
1228 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN; | 1226 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN; |
1229 } | 1227 } |
1230 } | 1228 } |
1231 | 1229 |
1232 void UserSessionManager::RestoreAuthSessionImpl( | 1230 void UserSessionManager::RestoreAuthSessionImpl( |
(...skipping 27 matching lines...) Expand all Loading... |
1260 // restore case when Chrome is restarting after crash or to apply custom user | 1258 // restore case when Chrome is restarting after crash or to apply custom user |
1261 // flags. In that case auth_request_context will be nullptr which is accepted | 1259 // flags. In that case auth_request_context will be nullptr which is accepted |
1262 // by RestoreSession() for session restore case. | 1260 // by RestoreSession() for session restore case. |
1263 if (!auth_request_context && | 1261 if (!auth_request_context && |
1264 (authenticator_.get() && authenticator_->authentication_context())) { | 1262 (authenticator_.get() && authenticator_->authentication_context())) { |
1265 auth_request_context = | 1263 auth_request_context = |
1266 authenticator_->authentication_context()->GetRequestContext(); | 1264 authenticator_->authentication_context()->GetRequestContext(); |
1267 } | 1265 } |
1268 login_manager->RestoreSession(auth_request_context, session_restore_strategy_, | 1266 login_manager->RestoreSession(auth_request_context, session_restore_strategy_, |
1269 user_context_.GetRefreshToken(), | 1267 user_context_.GetRefreshToken(), |
1270 user_context_.GetAuthCode()); | 1268 user_context_.GetAccessToken()); |
1271 } | 1269 } |
1272 | 1270 |
1273 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) { | 1271 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) { |
1274 #if defined(ENABLE_RLZ) | 1272 #if defined(ENABLE_RLZ) |
1275 PrefService* local_state = g_browser_process->local_state(); | 1273 PrefService* local_state = g_browser_process->local_state(); |
1276 if (disabled) { | 1274 if (disabled) { |
1277 // Empty brand code means an organic install (no RLZ pings are sent). | 1275 // Empty brand code means an organic install (no RLZ pings are sent). |
1278 google_brand::chromeos::ClearBrandForCurrentSession(); | 1276 google_brand::chromeos::ClearBrandForCurrentSession(); |
1279 } | 1277 } |
1280 if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) { | 1278 if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) { |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 if (is_enterprise_managed) | 1657 if (is_enterprise_managed) |
1660 display = USER_PODS_DISPLAY_DISABLED_MANAGED; | 1658 display = USER_PODS_DISPLAY_DISABLED_MANAGED; |
1661 else | 1659 else |
1662 display = USER_PODS_DISPLAY_DISABLED_REGULAR; | 1660 display = USER_PODS_DISPLAY_DISABLED_REGULAR; |
1663 } | 1661 } |
1664 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, | 1662 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, |
1665 NUM_USER_PODS_DISPLAY); | 1663 NUM_USER_PODS_DISPLAY); |
1666 } | 1664 } |
1667 | 1665 |
1668 } // namespace chromeos | 1666 } // namespace chromeos |
OLD | NEW |