OLD | NEW |
1 // Copyright (c) 2012 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 |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 std::string email; | 654 std::string email; |
655 ParseUserInfoResponse(data, &email); | 655 ParseUserInfoResponse(data, &email); |
656 VLOG(1) << "GAIA user info fetched for " << email << "."; | 656 VLOG(1) << "GAIA user info fetched for " << email << "."; |
657 consumer_->OnUserInfoSuccess(email); | 657 consumer_->OnUserInfoSuccess(email); |
658 } else { | 658 } else { |
659 consumer_->OnUserInfoFailure(GenerateAuthError(data, status, | 659 consumer_->OnUserInfoFailure(GenerateAuthError(data, status, |
660 response_code)); | 660 response_code)); |
661 } | 661 } |
662 } | 662 } |
663 | 663 |
664 void GaiaOAuthFetcher::OnURLFetchComplete(const content::URLFetcher* source) { | 664 void GaiaOAuthFetcher::OnURLFetchComplete(const net::URLFetcher* source) { |
665 // Keep |fetcher_| around to avoid invalidating its |status| (accessed below). | 665 // Keep |fetcher_| around to avoid invalidating its |status| (accessed below). |
666 scoped_ptr<content::URLFetcher> current_fetcher(fetcher_.release()); | 666 scoped_ptr<content::URLFetcher> current_fetcher(fetcher_.release()); |
667 fetch_pending_ = false; | 667 fetch_pending_ = false; |
668 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); | 668 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); |
669 GURL url = source->GetURL(); | 669 GURL url = source->GetURL(); |
670 std::string data; | 670 std::string data; |
671 source->GetResponseAsString(&data); | 671 source->GetResponseAsString(&data); |
672 net::URLRequestStatus status = source->GetStatus(); | 672 net::URLRequestStatus status = source->GetStatus(); |
673 int response_code = source->GetResponseCode(); | 673 int response_code = source->GetResponseCode(); |
674 if (StartsWithASCII(url.spec(), gaia_urls->get_oauth_token_url(), true)) { | 674 if (StartsWithASCII(url.spec(), gaia_urls->get_oauth_token_url(), true)) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 } | 724 } |
725 } else { | 725 } else { |
726 NOTREACHED() << "GaiaOAuthFetcher unknown url=" << url.spec(); | 726 NOTREACHED() << "GaiaOAuthFetcher unknown url=" << url.spec(); |
727 } | 727 } |
728 } | 728 } |
729 } | 729 } |
730 | 730 |
731 bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) { | 731 bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) { |
732 return fetch_step <= auto_fetch_limit_; | 732 return fetch_step <= auto_fetch_limit_; |
733 } | 733 } |
OLD | NEW |