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

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

Issue 1140823007: Revert of Move token handle obtaining to UserSessionManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 } 1229 }
1230 1230
1231 void ExistingUserController::OnOAuth2TokensFetched( 1231 void ExistingUserController::OnOAuth2TokensFetched(
1232 bool success, 1232 bool success,
1233 const UserContext& user_context) { 1233 const UserContext& user_context) {
1234 if (!success) { 1234 if (!success) {
1235 LOG(ERROR) << "OAuth2 token fetch failed."; 1235 LOG(ERROR) << "OAuth2 token fetch failed.";
1236 OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN)); 1236 OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN));
1237 return; 1237 return;
1238 } 1238 }
1239 UserSessionManager::GetInstance()->OnOAuth2TokensFetched(user_context); 1239 if (StartupUtils::IsWebviewSigninEnabled() && TokenHandlesEnabled()) {
1240 if (!token_handle_util_.get()) {
1241 token_handle_util_.reset(
1242 new TokenHandleUtil(user_manager::UserManager::Get()));
1243 }
1244 if (token_handle_util_->ShouldObtainHandle(user_context.GetUserID())) {
1245 token_handle_util_->GetTokenHandle(
1246 user_context.GetUserID(), user_context.GetAccessToken(),
1247 base::Bind(&ExistingUserController::OnTokenHandleObtained,
1248 weak_factory_.GetWeakPtr()));
1249 }
1250 }
1240 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); 1251 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
1241 } 1252 }
1242 1253
1254 void ExistingUserController::OnTokenHandleObtained(
1255 const user_manager::UserID& id,
1256 TokenHandleUtil::TokenHandleStatus status) {
1257 if (status != TokenHandleUtil::VALID) {
1258 LOG(ERROR) << "OAuth2 token handle fetch failed.";
1259 return;
1260 }
1261 }
1262
1263 bool ExistingUserController::TokenHandlesEnabled() {
1264 bool ephemeral_users_enabled = false;
1265 bool show_names_on_signin = true;
1266 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled,
1267 &ephemeral_users_enabled);
1268 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn,
1269 &show_names_on_signin);
1270 return show_names_on_signin && !ephemeral_users_enabled;
1271 }
1272
1243 } // namespace chromeos 1273 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/existing_user_controller.h ('k') | chrome/browser/chromeos/login/session/user_session_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698