summaryrefslogtreecommitdiffstats
path: root/google_apis/gaia/gaia_auth_fetcher.cc
diff options
context:
space:
mode:
authorguohui@chromium.org <guohui@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-17 04:01:24 +0000
committerguohui@chromium.org <guohui@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-17 04:01:24 +0000
commit5da3ebe20b39f982a1b4d9d7d6e55a959137d253 (patch)
treecac3df96cc1dceb9b23eb0c59dac4dd0d1c5b9fa /google_apis/gaia/gaia_auth_fetcher.cc
parent6a98d94c2732fc81f862ebfa608fd0f23e84444f (diff)
downloadchromium_src-5da3ebe20b39f982a1b4d9d7d6e55a959137d253.zip
chromium_src-5da3ebe20b39f982a1b4d9d7d6e55a959137d253.tar.gz
chromium_src-5da3ebe20b39f982a1b4d9d7d6e55a959137d253.tar.bz2
Fix skip for now link with inline flow
For details, please refer to the attached bug BUG=328563, 329016 Review URL: https://codereview.chromium.org/115343005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241148 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/gaia/gaia_auth_fetcher.cc')
-rw-r--r--google_apis/gaia/gaia_auth_fetcher.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc
index c5254f4..f3e85146 100644
--- a/google_apis/gaia/gaia_auth_fetcher.cc
+++ b/google_apis/gaia/gaia_auth_fetcher.cc
@@ -185,7 +185,8 @@ GaiaAuthFetcher::GaiaAuthFetcher(GaiaAuthConsumer* consumer,
list_accounts_gurl_(GaiaUrls::GetInstance()->list_accounts_url()),
client_login_to_oauth2_gurl_(
GaiaUrls::GetInstance()->client_login_to_oauth2_url()),
- fetch_pending_(false) {}
+ fetch_pending_(false),
+ fetch_code_only_(false) {}
GaiaAuthFetcher::~GaiaAuthFetcher() {}
@@ -545,6 +546,13 @@ void GaiaAuthFetcher::StartRevokeOAuth2Token(const std::string& auth_token) {
fetcher_->Start();
}
+void GaiaAuthFetcher::StartCookieForOAuthCodeExchange(
+ const std::string& session_index) {
+ // Same as the first step of StartCookieForOAuthLoginTokenExchange;
+ StartCookieForOAuthLoginTokenExchange(session_index);
+ fetch_code_only_ = true;
+}
+
void GaiaAuthFetcher::StartCookieForOAuthLoginTokenExchange(
const std::string& session_index) {
DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
@@ -566,6 +574,7 @@ void GaiaAuthFetcher::StartCookieForOAuthLoginTokenExchange(
net::LOAD_NORMAL,
this));
fetch_pending_ = true;
+ fetch_code_only_ = false;
fetcher_->Start();
}
@@ -817,9 +826,16 @@ void GaiaAuthFetcher::OnClientLoginToOAuth2Fetched(
if (status.is_success() && response_code == net::HTTP_OK) {
std::string auth_code;
ParseClientLoginToOAuth2Response(cookies, &auth_code);
- StartAuthCodeForOAuth2TokenExchange(auth_code);
+ if (fetch_code_only_)
+ consumer_->OnClientOAuthCodeSuccess(auth_code);
+ else
+ StartAuthCodeForOAuth2TokenExchange(auth_code);
} else {
- consumer_->OnClientOAuthFailure(GenerateAuthError(data, status));
+ GoogleServiceAuthError auth_error(GenerateAuthError(data, status));
+ if (fetch_code_only_)
+ consumer_->OnClientOAuthCodeFailure(auth_error);
+ else
+ consumer_->OnClientOAuthFailure(auth_error);
}
}