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

Unified Diff: components/signin/core/browser/gaia_cookie_manager_service.cc

Issue 1129463004: Let Ubertoken Fetch be primed with an access token. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ChromeOS sends access token to GCMS 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: components/signin/core/browser/gaia_cookie_manager_service.cc
diff --git a/components/signin/core/browser/gaia_cookie_manager_service.cc b/components/signin/core/browser/gaia_cookie_manager_service.cc
index e8a0cb76802947ef5702a025e003df2f7c585d55..415d14baf4c8e003686194c5d617bc66b43d47e2 100644
--- a/components/signin/core/browser/gaia_cookie_manager_service.cc
+++ b/components/signin/core/browser/gaia_cookie_manager_service.cc
@@ -309,6 +309,11 @@ void GaiaCookieManagerService::Shutdown() {
void GaiaCookieManagerService::AddAccountToCookie(
const std::string& account_id) {
+ AddAccountToCookieWithToken(account_id, std::string());
+}
+
+void GaiaCookieManagerService::AddAccountToCookieWithToken(
+ const std::string& account_id, const std::string& oauth2_token) {
if (!signin_client_->AreSigninCookiesAllowed()) {
SignalComplete(account_id,
GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED));
@@ -318,8 +323,9 @@ void GaiaCookieManagerService::AddAccountToCookie(
DCHECK(!account_id.empty());
VLOG(1) << "GaiaCookieManagerService::AddAccountToCookie: " << account_id;
requests_.push_back(GaiaCookieRequest::CreateAddAccountRequest(account_id));
- if (requests_.size() == 1)
- StartFetchingUbertoken();
+ if (requests_.size() == 1) {
+ StartFetchingUbertoken(oauth2_token);
+ }
}
bool GaiaCookieManagerService::ListAccounts(
@@ -566,13 +572,17 @@ void GaiaCookieManagerService::OnListAccountsFailure(
HandleNextRequest();
}
-void GaiaCookieManagerService::StartFetchingUbertoken() {
+void GaiaCookieManagerService::StartFetchingUbertoken(
+ const std::string& access_token) {
VLOG(1) << "GaiaCookieManagerService::StartFetching account_id="
<< requests_.front().account_id();
uber_token_fetcher_.reset(
new UbertokenFetcher(token_service_, this, source_,
signin_client_->GetURLRequestContext()));
- uber_token_fetcher_->StartFetchingToken(requests_.front().account_id());
+ if (access_token.empty())
+ uber_token_fetcher_->StartFetchingToken(requests_.front().account_id());
+ else
+ uber_token_fetcher_->OnGetTokenSuccess(nullptr, access_token, base::Time());
}
void GaiaCookieManagerService::StartFetchingMergeSession() {
@@ -635,7 +645,7 @@ void GaiaCookieManagerService::HandleNextRequest() {
} else {
switch (requests_.front().request_type()) {
case GaiaCookieRequestType::ADD_ACCOUNT:
- StartFetchingUbertoken();
+ StartFetchingUbertoken(std::string());
break;
case GaiaCookieRequestType::LOG_OUT:
StartLogOutUrlFetch();

Powered by Google App Engine
This is Rietveld 408576698