OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/net/gaia/gaia_auth_fetcher.h" | 5 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 int response_code) { | 571 int response_code) { |
572 if (status.is_success() && response_code == RC_REQUEST_OK) { | 572 if (status.is_success() && response_code == RC_REQUEST_OK) { |
573 consumer_->OnMergeSessionSuccess(data); | 573 consumer_->OnMergeSessionSuccess(data); |
574 } else { | 574 } else { |
575 consumer_->OnMergeSessionFailure(GenerateAuthError(data, status)); | 575 consumer_->OnMergeSessionFailure(GenerateAuthError(data, status)); |
576 } | 576 } |
577 } | 577 } |
578 | 578 |
579 void GaiaAuthFetcher::OnURLFetchComplete(const content::URLFetcher* source) { | 579 void GaiaAuthFetcher::OnURLFetchComplete(const content::URLFetcher* source) { |
580 fetch_pending_ = false; | 580 fetch_pending_ = false; |
581 const GURL& url = source->GetUrl(); | 581 const GURL& url = source->GetURL(); |
582 const net::URLRequestStatus& status = source->GetStatus(); | 582 const net::URLRequestStatus& status = source->GetStatus(); |
583 int response_code = source->GetResponseCode(); | 583 int response_code = source->GetResponseCode(); |
584 std::string data; | 584 std::string data; |
585 source->GetResponseAsString(&data); | 585 source->GetResponseAsString(&data); |
586 if (url == client_login_gurl_) { | 586 if (url == client_login_gurl_) { |
587 OnClientLoginFetched(data, status, response_code); | 587 OnClientLoginFetched(data, status, response_code); |
588 } else if (url == issue_auth_token_gurl_) { | 588 } else if (url == issue_auth_token_gurl_) { |
589 OnIssueAuthTokenFetched(data, status, response_code); | 589 OnIssueAuthTokenFetched(data, status, response_code); |
590 } else if (url == get_user_info_gurl_) { | 590 } else if (url == get_user_info_gurl_) { |
591 OnGetUserInfoFetched(data, status, response_code); | 591 OnGetUserInfoFetched(data, status, response_code); |
592 } else if (url == token_auth_gurl_) { | 592 } else if (url == token_auth_gurl_) { |
593 OnTokenAuthFetched(data, status, response_code); | 593 OnTokenAuthFetched(data, status, response_code); |
594 } else if (url == merge_session_gurl_ || | 594 } else if (url == merge_session_gurl_ || |
595 (source && source->GetOriginalUrl() == merge_session_gurl_)) { | 595 (source && source->GetOriginalURL() == merge_session_gurl_)) { |
596 // MergeSession may redirect, so check the original URL of the fetcher. | 596 // MergeSession may redirect, so check the original URL of the fetcher. |
597 OnMergeSessionFetched(data, status, response_code); | 597 OnMergeSessionFetched(data, status, response_code); |
598 } else { | 598 } else { |
599 NOTREACHED(); | 599 NOTREACHED(); |
600 } | 600 } |
601 } | 601 } |
602 | 602 |
603 // static | 603 // static |
604 bool GaiaAuthFetcher::IsSecondFactorSuccess( | 604 bool GaiaAuthFetcher::IsSecondFactorSuccess( |
605 const std::string& alleged_error) { | 605 const std::string& alleged_error) { |
606 return alleged_error.find(kSecondFactor) != | 606 return alleged_error.find(kSecondFactor) != |
607 std::string::npos; | 607 std::string::npos; |
608 } | 608 } |
OLD | NEW |