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

Unified Diff: chrome/browser/net/gaia/gaia_oauth_fetcher.cc

Issue 10382077: Update all GAIA URLs to accounts.google.com/... from www.google.com/accounts/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/net/gaia/gaia_oauth_fetcher.cc
diff --git a/chrome/browser/net/gaia/gaia_oauth_fetcher.cc b/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
index 2d126970ee537354043fbc5fe1a4da9db82f9277..fa692652deb2eb14e2d8edc19c796e8278ebcb67 100644
--- a/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
+++ b/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
@@ -21,6 +21,7 @@
#include "chrome/common/net/gaia/gaia_urls.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
#include "chrome/common/net/gaia/oauth_request_signer.h"
+#include "chrome/common/net/url_util.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/common/url_fetcher.h"
@@ -685,7 +686,45 @@ void GaiaOAuthFetcher::OnURLFetchComplete(const content::URLFetcher* source) {
true)) {
OnOAuthRevokeTokenFetched(data, status, response_code);
} else {
- NOTREACHED();
+ // Invalid cookies cause Gaia to redirect to ServiceLogin. Check if
+ // this is the case and report failure properly.
+ std::string url_no_query = url.GetOrigin().spec() + url.path().substr(1);
+ std::string continue_url;
+ if (url_no_query == gaia_urls->service_login_url() &&
+ chrome_common_net::GetValueForKeyInQuery(url, "continue",
+ &continue_url)) {
+ LOG(ERROR) << "GaiaOAuthFetcher redirected to service login"
+ << " , url=" << url.spec();
+
+ if (StartsWithASCII(continue_url,
+ gaia_urls->get_oauth_token_url(),
+ true)) {
+ consumer_->OnGetOAuthTokenFailure(GoogleServiceAuthError(
+ GoogleServiceAuthError::SERVICE_UNAVAILABLE));
+ } else if (continue_url == gaia_urls->oauth1_login_url()) {
+ consumer_->OnOAuthLoginFailure(GoogleServiceAuthError(
+ GoogleServiceAuthError::SERVICE_UNAVAILABLE));
+ } else if (continue_url == gaia_urls->oauth_get_access_token_url()) {
+ consumer_->OnOAuthGetAccessTokenFailure(GoogleServiceAuthError(
+ GoogleServiceAuthError::SERVICE_UNAVAILABLE));
+ } else if (continue_url == gaia_urls->oauth_wrap_bridge_url()) {
+ consumer_->OnOAuthWrapBridgeFailure(service_scope_,
+ GoogleServiceAuthError(
+ GoogleServiceAuthError::SERVICE_UNAVAILABLE));
+ } else if (continue_url == gaia_urls->oauth_user_info_url()) {
+ consumer_->OnUserInfoFailure(GoogleServiceAuthError(
+ GoogleServiceAuthError::SERVICE_UNAVAILABLE));
+ } else if (StartsWithASCII(continue_url,
+ gaia_urls->oauth_revoke_token_url(),
+ true)) {
+ consumer_->OnOAuthRevokeTokenFailure(GoogleServiceAuthError(
+ GoogleServiceAuthError::SERVICE_UNAVAILABLE));
+ } else {
+ NOTREACHED();
+ }
+ } else {
+ NOTREACHED() << "GaiaOAuthFetcher unknown url=" << url.spec();
+ }
}
}
« no previous file with comments | « chrome/browser/importer/importer_host.cc ('k') | chrome/browser/password_manager/login_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698