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

Unified Diff: chrome/browser/ui/webui/signin/inline_login_handler_impl.cc

Issue 473153002: Inline sign in extracts gaia id from HTTP header and seeds account tracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 4 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/ui/webui/signin/inline_login_handler_impl.cc
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
index 25dce577bab4195c74b0dca0db4b15ab9c30bd84..ee96a859d7f4e1011c7a3e17dcb9b097496132a0 100644
--- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
@@ -13,6 +13,7 @@
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/about_signin_internals_factory.h"
+#include "chrome/browser/signin/account_tracker_service_factory.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
@@ -28,6 +29,7 @@
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/common/url_constants.h"
#include "components/signin/core/browser/about_signin_internals.h"
+#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_error_controller.h"
#include "components/signin/core/browser/signin_oauth_helper.h"
@@ -50,6 +52,7 @@ class InlineSigninHelper : public SigninOAuthHelper::Consumer {
Profile* profile,
const GURL& current_url,
const std::string& email,
+ const std::string& gaia_id,
const std::string& password,
const std::string& session_index,
const std::string& signin_scoped_device_id,
@@ -70,6 +73,7 @@ class InlineSigninHelper : public SigninOAuthHelper::Consumer {
Profile* profile_;
GURL current_url_;
std::string email_;
+ std::string gaia_id_;
std::string password_;
std::string session_index_;
bool choose_what_to_sync_;
@@ -84,6 +88,7 @@ InlineSigninHelper::InlineSigninHelper(
Profile* profile,
const GURL& current_url,
const std::string& email,
+ const std::string& gaia_id,
const std::string& password,
const std::string& session_index,
const std::string& signin_scoped_device_id,
@@ -95,6 +100,7 @@ InlineSigninHelper::InlineSigninHelper(
profile_(profile),
current_url_(current_url),
email_(email),
+ gaia_id_(gaia_id),
password_(password),
session_index_(session_index),
choose_what_to_sync_(choose_what_to_sync),
@@ -118,11 +124,19 @@ void InlineSigninHelper::OnSigninOAuthInformationAvailable(
AboutSigninInternalsFactory::GetForProfile(profile_);
about_signin_internals->OnRefreshTokenReceived("Successful");
+ AccountTrackerService* account_tracker =
+ AccountTrackerServiceFactory::GetForProfile(profile_);
+ std::string account_id =
+ account_tracker->PickAccountIdForAccount(gaia_id_, email);
+
+ // Prime the account tracker with this combination of gaia id/display email.
+ account_tracker->SeedAccountInfo(account_id, gaia_id_, email_);
guohui 2014/08/21 18:39:43 why do we use email_ here and email at line 130? A
Roger Tawa OOO till Jul 10th 2014/08/21 20:33:18 |email| and |email_| are not guaranteed to be the
+
signin::Source source = signin::GetSourceForPromoURL(current_url_);
if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT ||
source == signin::SOURCE_REAUTH) {
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
- UpdateCredentials(email, refresh_token);
+ UpdateCredentials(account_id, refresh_token);
if (signin::IsAutoCloseEnabledInURL(current_url_)) {
// Close the gaia sign in tab via a task to make sure we aren't in the
@@ -185,7 +199,7 @@ void InlineSigninHelper::OnSigninOAuthInformationAvailable(
// OneClickSigninSyncStarter will delete itself once the job is done.
new OneClickSigninSyncStarter(
profile_, browser,
- email, password_, refresh_token,
+ account_id, password_, refresh_token,
start_mode,
contents,
confirmation_required,
@@ -212,8 +226,7 @@ void InlineSigninHelper::OnSigninOAuthInformationFailure(
} // namespace
InlineLoginHandlerImpl::InlineLoginHandlerImpl()
- : weak_factory_(this),
- confirm_untrusted_signin_(false) {
+ : weak_factory_(this), confirm_untrusted_signin_(false) {
}
InlineLoginHandlerImpl::~InlineLoginHandlerImpl() {}
@@ -293,6 +306,11 @@ void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) {
dict->GetString("password", &password_string16);
std::string password(base::UTF16ToASCII(password_string16));
+ base::string16 gaia_id_string16;
+ dict->GetString("gaiaId", &gaia_id_string16);
+ DCHECK(!gaia_id_string16.empty());
+ std::string gaia_id = base::UTF16ToASCII(gaia_id_string16);
+
// When doing a SAML sign in, this email check may result in a false
// positive. This happens when the user types one email address in the
// gaia sign in page, but signs in to a different account in the SAML sign in
@@ -371,7 +389,7 @@ void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) {
// InlineSigninHelper will delete itself.
new InlineSigninHelper(GetWeakPtr(), partition->GetURLRequestContext(),
Profile::FromWebUI(web_ui()), current_url,
- email, password, session_index,
+ email, gaia_id, password, session_index,
signin_scoped_device_id, choose_what_to_sync,
confirm_untrusted_signin_);
« no previous file with comments | « chrome/browser/ui/webui/signin/inline_login_handler_impl.h ('k') | components/signin/core/browser/account_tracker_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698