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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/existing_user_controller.cc
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 4588e82ce75a8a512764bd3db029dc30491401b3..e9367efc3a4646fe13c7114274f958af0b7ac769 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -1236,8 +1236,38 @@
OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN));
return;
}
- UserSessionManager::GetInstance()->OnOAuth2TokensFetched(user_context);
+ if (StartupUtils::IsWebviewSigninEnabled() && TokenHandlesEnabled()) {
+ if (!token_handle_util_.get()) {
+ token_handle_util_.reset(
+ new TokenHandleUtil(user_manager::UserManager::Get()));
+ }
+ if (token_handle_util_->ShouldObtainHandle(user_context.GetUserID())) {
+ token_handle_util_->GetTokenHandle(
+ user_context.GetUserID(), user_context.GetAccessToken(),
+ base::Bind(&ExistingUserController::OnTokenHandleObtained,
+ weak_factory_.GetWeakPtr()));
+ }
+ }
PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
}
+void ExistingUserController::OnTokenHandleObtained(
+ const user_manager::UserID& id,
+ TokenHandleUtil::TokenHandleStatus status) {
+ if (status != TokenHandleUtil::VALID) {
+ LOG(ERROR) << "OAuth2 token handle fetch failed.";
+ return;
+ }
+}
+
+bool ExistingUserController::TokenHandlesEnabled() {
+ bool ephemeral_users_enabled = false;
+ bool show_names_on_signin = true;
+ cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled,
+ &ephemeral_users_enabled);
+ cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn,
+ &show_names_on_signin);
+ return show_names_on_signin && !ephemeral_users_enabled;
+}
+
} // namespace chromeos
« 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