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

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 doesn't always have an access token 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
« no previous file with comments | « components/signin/core/browser/gaia_cookie_manager_service.h ('k') | google_apis/gaia/ubertoken_fetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7eb1c283465c9d5ce76504a86f7973fc8bc04f0d..08af3f499747c888e8e3bb2de4412a5924d36b7e 100644
--- a/components/signin/core/browser/gaia_cookie_manager_service.cc
+++ b/components/signin/core/browser/gaia_cookie_manager_service.cc
@@ -307,16 +307,16 @@ void GaiaCookieManagerService::Shutdown() {
cookie_changed_subscription_.reset();
}
-void GaiaCookieManagerService::AddAccountToCookie(
+
+void GaiaCookieManagerService::AddAccountToCookieInternal(
const std::string& account_id) {
+ DCHECK(!account_id.empty());
if (!signin_client_->AreSigninCookiesAllowed()) {
SignalComplete(account_id,
GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED));
return;
}
- DCHECK(!account_id.empty());
- VLOG(1) << "GaiaCookieManagerService::AddAccountToCookie: " << account_id;
requests_.push_back(GaiaCookieRequest::CreateAddAccountRequest(account_id));
if (requests_.size() == 1) {
signin_client_->DelayNetworkCall(
@@ -325,6 +325,23 @@ void GaiaCookieManagerService::AddAccountToCookie(
}
}
+void GaiaCookieManagerService::AddAccountToCookie(
+ const std::string& account_id) {
+ VLOG(1) << "GaiaCookieManagerService::AddAccountToCookie: " << account_id;
+ access_token_ = std::string();
+ AddAccountToCookieInternal(account_id);
+}
+
+void GaiaCookieManagerService::AddAccountToCookieWithToken(
+ const std::string& account_id,
+ const std::string& access_token) {
+ VLOG(1) << "GaiaCookieManagerService::AddAccountToCookieWithToken: "
+ << account_id;
+ DCHECK(!access_token.empty());
+ access_token_ = access_token;
+ AddAccountToCookieInternal(account_id);
+}
+
bool GaiaCookieManagerService::ListAccounts(
std::vector<std::pair<std::string,bool> >* accounts) {
DCHECK(accounts);
@@ -590,12 +607,17 @@ void GaiaCookieManagerService::OnListAccountsFailure(
}
void GaiaCookieManagerService::StartFetchingUbertoken() {
- VLOG(1) << "GaiaCookieManagerService::StartFetching account_id="
+ VLOG(1) << "GaiaCookieManagerService::StartFetchingUbertoken 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_->StartFetchingTokenWithAccessToken(
+ requests_.front().account_id(), access_token_);
+ }
}
void GaiaCookieManagerService::StartFetchingMergeSession() {
@@ -659,6 +681,7 @@ void GaiaCookieManagerService::HandleNextRequest() {
if (requests_.empty()) {
VLOG(1) << "GaiaCookieManagerService::HandleNextRequest: no more";
uber_token_fetcher_.reset();
+ access_token_ = std::string();
} else {
switch (requests_.front().request_type()) {
case GaiaCookieRequestType::ADD_ACCOUNT:
« no previous file with comments | « components/signin/core/browser/gaia_cookie_manager_service.h ('k') | google_apis/gaia/ubertoken_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698