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

Unified Diff: chrome/browser/chromeos/login/signin/oauth2_token_fetcher.cc

Issue 1138143002: Pass Device ID in the oauth2/token request. Keep Device ID in local state on Chrome OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final version. 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/signin/oauth2_token_fetcher.cc
diff --git a/chrome/browser/chromeos/login/signin/oauth2_token_fetcher.cc b/chrome/browser/chromeos/login/signin/oauth2_token_fetcher.cc
index b898018f9529260ab8b9344456ff5e3fa54b35d1..c98f7905fdea09d2c4497afa56de5e843058c99d 100644
--- a/chrome/browser/chromeos/login/signin/oauth2_token_fetcher.cc
+++ b/chrome/browser/chromeos/login/signin/oauth2_token_fetcher.cc
@@ -68,9 +68,11 @@ void OAuth2TokenFetcher::StartExchangeFromCookies(
}
void OAuth2TokenFetcher::StartExchangeFromAuthCode(
- const std::string& auth_code) {
+ const std::string& auth_code,
+ const std::string& signin_scoped_device_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auth_code_ = auth_code;
+ signin_scoped_device_id_ = signin_scoped_device_id;
// Delay the verification if the network is not connected or on a captive
// portal.
const NetworkState* default_network =
@@ -81,13 +83,13 @@ void OAuth2TokenFetcher::StartExchangeFromAuthCode(
VLOG(1) << "Network is offline. Deferring OAuth2 token fetch.";
BrowserThread::PostDelayedTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(&OAuth2TokenFetcher::StartExchangeFromAuthCode,
- AsWeakPtr(),
- auth_code),
+ base::Bind(&OAuth2TokenFetcher::StartExchangeFromAuthCode, AsWeakPtr(),
+ auth_code, signin_scoped_device_id),
base::TimeDelta::FromMilliseconds(kRequestRestartDelay));
return;
}
- auth_fetcher_.StartAuthCodeForOAuth2TokenExchange(auth_code);
+ auth_fetcher_.StartAuthCodeForOAuth2TokenExchangeWithDeviceId(
+ auth_code, signin_scoped_device_id);
}
void OAuth2TokenFetcher::OnClientOAuthSuccess(
@@ -102,17 +104,15 @@ void OAuth2TokenFetcher::OnClientOAuthSuccess(
void OAuth2TokenFetcher::OnClientOAuthFailure(
const GoogleServiceAuthError& error) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- RetryOnError(error,
- auth_code_.empty()
- ? base::Bind(&OAuth2TokenFetcher::StartExchangeFromCookies,
- AsWeakPtr(),
- session_index_,
- signin_scoped_device_id_)
- : base::Bind(&OAuth2TokenFetcher::StartExchangeFromAuthCode,
- AsWeakPtr(),
- auth_code_),
- base::Bind(&Delegate::OnOAuth2TokensFetchFailed,
- base::Unretained(delegate_)));
+ RetryOnError(
+ error,
+ auth_code_.empty()
+ ? base::Bind(&OAuth2TokenFetcher::StartExchangeFromCookies,
+ AsWeakPtr(), session_index_, signin_scoped_device_id_)
+ : base::Bind(&OAuth2TokenFetcher::StartExchangeFromAuthCode,
+ AsWeakPtr(), auth_code_, signin_scoped_device_id_),
+ base::Bind(&Delegate::OnOAuth2TokensFetchFailed,
+ base::Unretained(delegate_)));
}
void OAuth2TokenFetcher::RetryOnError(const GoogleServiceAuthError& error,

Powered by Google App Engine
This is Rietveld 408576698