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

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

Issue 1138883003: Disable token handle fetching on some devices (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 if (StartupUtils::IsWebviewSigninEnabled()) { 1239 if (StartupUtils::IsWebviewSigninEnabled() && TokenHandlesEnabled()) {
1240 if (!token_handle_util_.get()) { 1240 if (!token_handle_util_.get()) {
1241 token_handle_util_.reset( 1241 token_handle_util_.reset(
1242 new TokenHandleUtil(user_manager::UserManager::Get())); 1242 new TokenHandleUtil(user_manager::UserManager::Get()));
1243 } 1243 }
1244 if (!token_handle_util_->HasToken(user_context.GetUserID())) { 1244 if (!token_handle_util_->HasToken(user_context.GetUserID())) {
1245 token_handle_util_->GetTokenHandle( 1245 token_handle_util_->GetTokenHandle(
1246 user_context.GetUserID(), user_context.GetAccessToken(), 1246 user_context.GetUserID(), user_context.GetAccessToken(),
1247 base::Bind(&ExistingUserController::OnTokenHandleObtained, 1247 base::Bind(&ExistingUserController::OnTokenHandleObtained,
1248 weak_factory_.GetWeakPtr())); 1248 weak_factory_.GetWeakPtr()));
1249 } 1249 }
1250 } 1250 }
1251 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); 1251 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
1252 } 1252 }
1253 1253
1254 void ExistingUserController::OnTokenHandleObtained( 1254 void ExistingUserController::OnTokenHandleObtained(
1255 const user_manager::UserID& id, 1255 const user_manager::UserID& id,
1256 TokenHandleUtil::TokenHandleStatus status) { 1256 TokenHandleUtil::TokenHandleStatus status) {
1257 if (status != TokenHandleUtil::VALID) { 1257 if (status != TokenHandleUtil::VALID) {
1258 LOG(ERROR) << "OAuth2 token handle fetch failed."; 1258 LOG(ERROR) << "OAuth2 token handle fetch failed.";
1259 return; 1259 return;
1260 } 1260 }
1261 } 1261 }
1262 1262
1263 bool ExistingUserController::TokenHandlesEnabled() {
Nikita (slow) 2015/05/13 08:34:52 I suggest having static function in TokenHandleUti
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
1263 } // namespace chromeos 1273 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698