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

Unified Diff: google_apis/gaia/gaia_auth_fetcher.cc

Issue 57363003: Enable account reconcilor when --new-profile-management is used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unsigned check in tests again Created 7 years, 1 month 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: google_apis/gaia/gaia_auth_fetcher.cc
diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc
index f0e26445a52d6e6b94421972d450d6a6d2534ad4..8c0eb9a4f54aa3deb2e52393da486b4c183f01c6 100644
--- a/google_apis/gaia/gaia_auth_fetcher.cc
+++ b/google_apis/gaia/gaia_auth_fetcher.cc
@@ -182,6 +182,7 @@ GaiaAuthFetcher::GaiaAuthFetcher(GaiaAuthConsumer* consumer,
uberauth_token_gurl_(GaiaUrls::GetInstance()->oauth1_login_url().Resolve(
base::StringPrintf(kUberAuthTokenURLFormat, source.c_str()))),
oauth_login_gurl_(GaiaUrls::GetInstance()->oauth1_login_url()),
+ list_accounts_gurl_(GaiaUrls::GetInstance()->list_accounts_url()),
client_login_to_oauth2_gurl_(
GaiaUrls::GetInstance()->client_login_to_oauth2_url()),
fetch_pending_(false) {}
@@ -659,6 +660,19 @@ void GaiaAuthFetcher::StartOAuthLogin(const std::string& access_token,
fetcher_->Start();
}
+void GaiaAuthFetcher::StartListAccounts() {
+ DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
+
+ fetcher_.reset(CreateGaiaFetcher(getter_,
+ " ", // To force an HTTP POST.
+ "Origin: https://www.google.com",
+ list_accounts_gurl_,
+ net::LOAD_NORMAL,
+ this));
+ fetch_pending_ = true;
+ fetcher_->Start();
+}
+
// static
GoogleServiceAuthError GaiaAuthFetcher::GenerateAuthError(
const std::string& data,
@@ -844,6 +858,16 @@ void GaiaAuthFetcher::OnOAuth2RevokeTokenFetched(
consumer_->OnOAuth2RevokeTokenCompleted();
}
+void GaiaAuthFetcher::OnListAccountsFetched(const std::string& data,
+ const net::URLRequestStatus& status,
+ int response_code) {
+ if (status.is_success() && response_code == net::HTTP_OK) {
+ consumer_->OnListAccountsSuccess(data);
+ } else {
+ consumer_->OnListAccountsFailure(GenerateAuthError(data, status));
+ }
+}
+
void GaiaAuthFetcher::OnGetUserInfoFetched(
const std::string& data,
const net::URLRequestStatus& status,
@@ -937,6 +961,8 @@ void GaiaAuthFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
OnOAuthLoginFetched(data, status, response_code);
} else if (url == oauth2_revoke_gurl_) {
OnOAuth2RevokeTokenFetched(data, status, response_code);
+ } else if (url == list_accounts_gurl_) {
+ OnListAccountsFetched(data, status, response_code);
} else {
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698