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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
584 std::string data; | 585 std::string data; |
585 source->GetResponseAsString(&data); | 586 source->GetResponseAsString(&data); |
586 if (url == client_login_gurl_) { | 587 if (url == client_login_gurl_) { |
587 OnClientLoginFetched(data, status, response_code); | 588 OnClientLoginFetched(data, status, response_code); |
588 } else if (url == issue_auth_token_gurl_) { | 589 } else if (url == issue_auth_token_gurl_) { |
589 OnIssueAuthTokenFetched(data, status, response_code); | 590 OnIssueAuthTokenFetched(data, status, response_code); |
590 } else if (url == get_user_info_gurl_) { | 591 } else if (url == get_user_info_gurl_) { |
591 OnGetUserInfoFetched(data, status, response_code); | 592 OnGetUserInfoFetched(data, status, response_code); |
592 } else if (url == token_auth_gurl_) { | 593 } else if (url == token_auth_gurl_) { |
593 OnTokenAuthFetched(data, status, response_code); | 594 OnTokenAuthFetched(data, status, response_code); |
594 } else if (url == merge_session_gurl_ || | 595 } else if (url == merge_session_gurl_ || |
595 (source && source->GetOriginalURL() == merge_session_gurl_)) { | 596 (source && source->GetOriginalURL() == merge_session_gurl_)) { |
596 // MergeSession may redirect, so check the original URL of the fetcher. | 597 // MergeSession may redirect, so check the original URL of the fetcher. |
597 OnMergeSessionFetched(data, status, response_code); | 598 OnMergeSessionFetched(data, status, response_code); |
598 } else { | 599 } else { |
599 NOTREACHED(); | 600 NOTREACHED(); |
600 } | 601 } |
601 } | 602 } |
602 | 603 |
603 // static | 604 // static |
604 bool GaiaAuthFetcher::IsSecondFactorSuccess( | 605 bool GaiaAuthFetcher::IsSecondFactorSuccess( |
605 const std::string& alleged_error) { | 606 const std::string& alleged_error) { |
606 return alleged_error.find(kSecondFactor) != | 607 return alleged_error.find(kSecondFactor) != |
607 std::string::npos; | 608 std::string::npos; |
608 } | 609 } |
OLD | NEW |