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

Side by Side Diff: chrome/browser/net/gaia/gaia_oauth_fetcher.cc

Issue 9271025: Update Gaia URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits, fix unit_tests failure and update license headers Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" 5 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/string_split.h" 12 #include "base/string_split.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "chrome/browser/net/browser_url_util.h"
14 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h" 15 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/tabs/tab_strip_model.h" 17 #include "chrome/browser/tabs/tab_strip_model.h"
17 #include "chrome/browser/ui/browser_list.h" 18 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" 20 #include "chrome/common/net/gaia/gaia_auth_fetcher.h"
20 #include "chrome/common/net/gaia/gaia_constants.h" 21 #include "chrome/common/net/gaia/gaia_constants.h"
21 #include "chrome/common/net/gaia/gaia_urls.h" 22 #include "chrome/common/net/gaia/gaia_urls.h"
22 #include "chrome/common/net/gaia/google_service_auth_error.h" 23 #include "chrome/common/net/gaia/google_service_auth_error.h"
23 #include "chrome/common/net/gaia/oauth_request_signer.h" 24 #include "chrome/common/net/gaia/oauth_request_signer.h"
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 OnOAuthGetAccessTokenFetched(data, status, response_code); 680 OnOAuthGetAccessTokenFetched(data, status, response_code);
680 } else if (url.spec() == gaia_urls->oauth_wrap_bridge_url()) { 681 } else if (url.spec() == gaia_urls->oauth_wrap_bridge_url()) {
681 OnOAuthWrapBridgeFetched(data, status, response_code); 682 OnOAuthWrapBridgeFetched(data, status, response_code);
682 } else if (url.spec() == gaia_urls->oauth_user_info_url()) { 683 } else if (url.spec() == gaia_urls->oauth_user_info_url()) {
683 OnUserInfoFetched(data, status, response_code); 684 OnUserInfoFetched(data, status, response_code);
684 } else if (StartsWithASCII(url.spec(), 685 } else if (StartsWithASCII(url.spec(),
685 gaia_urls->oauth_revoke_token_url(), 686 gaia_urls->oauth_revoke_token_url(),
686 true)) { 687 true)) {
687 OnOAuthRevokeTokenFetched(data, status, response_code); 688 OnOAuthRevokeTokenFetched(data, status, response_code);
688 } else { 689 } else {
689 NOTREACHED(); 690 // Invalid cookies cause Gaia to redirect to ServiceLogin. Check if
691 // this is the case and report failure properly.
692 std::string url_no_query = url.GetOrigin().spec() + url.path().substr(1);
693 std::string continue_url;
694 if (url_no_query == gaia_urls->service_login_url() &&
695 chrome_browser_net::GetValueForKeyInQuery(url, "continue",
696 &continue_url)) {
697 LOG(ERROR) << "GaiaOAuthFetcher redirected to service login"
698 << " , url=" << url.spec();
699
700 if (StartsWithASCII(continue_url,
701 gaia_urls->get_oauth_token_url(),
702 true)) {
703 consumer_->OnGetOAuthTokenFailure(GoogleServiceAuthError(
704 GoogleServiceAuthError::SERVICE_UNAVAILABLE));
705 } else if (continue_url == gaia_urls->oauth1_login_url()) {
706 consumer_->OnOAuthLoginFailure(GoogleServiceAuthError(
707 GoogleServiceAuthError::SERVICE_UNAVAILABLE));
708 } else if (continue_url == gaia_urls->oauth_get_access_token_url()) {
709 consumer_->OnOAuthGetAccessTokenFailure(GoogleServiceAuthError(
710 GoogleServiceAuthError::SERVICE_UNAVAILABLE));
711 } else if (continue_url == gaia_urls->oauth_wrap_bridge_url()) {
712 consumer_->OnOAuthWrapBridgeFailure(service_scope_,
713 GoogleServiceAuthError(
714 GoogleServiceAuthError::SERVICE_UNAVAILABLE));
715 } else if (continue_url == gaia_urls->oauth_user_info_url()) {
716 consumer_->OnUserInfoFailure(GoogleServiceAuthError(
717 GoogleServiceAuthError::SERVICE_UNAVAILABLE));
718 } else if (StartsWithASCII(continue_url,
719 gaia_urls->oauth_revoke_token_url(),
720 true)) {
721 consumer_->OnOAuthRevokeTokenFailure(GoogleServiceAuthError(
722 GoogleServiceAuthError::SERVICE_UNAVAILABLE));
723 } else {
724 NOTREACHED();
725 }
726 } else {
727 NOTREACHED() << "GaiaOAuthFetcher unknown url=" << url.spec();
728 }
690 } 729 }
691 } 730 }
692 731
693 bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) { 732 bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) {
694 return fetch_step <= auto_fetch_limit_; 733 return fetch_step <= auto_fetch_limit_;
695 } 734 }
OLDNEW
« no previous file with comments | « chrome/browser/net/browser_url_util_unittest.cc ('k') | chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698