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/common/net/gaia/gaia_auth_fetcher.h" | 5 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 std::string lsid; | 1107 std::string lsid; |
1108 std::string token; | 1108 std::string token; |
1109 ParseClientLoginResponse(data, &sid, &lsid, &token); | 1109 ParseClientLoginResponse(data, &sid, &lsid, &token); |
1110 consumer_->OnClientLoginSuccess( | 1110 consumer_->OnClientLoginSuccess( |
1111 GaiaAuthConsumer::ClientLoginResult(sid, lsid, token, data)); | 1111 GaiaAuthConsumer::ClientLoginResult(sid, lsid, token, data)); |
1112 } else { | 1112 } else { |
1113 consumer_->OnClientLoginFailure(GenerateAuthError(data, status)); | 1113 consumer_->OnClientLoginFailure(GenerateAuthError(data, status)); |
1114 } | 1114 } |
1115 } | 1115 } |
1116 | 1116 |
1117 void GaiaAuthFetcher::OnURLFetchComplete(const content::URLFetcher* source) { | 1117 void GaiaAuthFetcher::OnURLFetchComplete(const net::URLFetcher* source) { |
1118 fetch_pending_ = false; | 1118 fetch_pending_ = false; |
1119 // Some of the GAIA requests perform redirects, which results in the final | 1119 // Some of the GAIA requests perform redirects, which results in the final |
1120 // URL of the fetcher not being the original URL requested. Therefore use | 1120 // URL of the fetcher not being the original URL requested. Therefore use |
1121 // the original URL when determining which OnXXX function to call. | 1121 // the original URL when determining which OnXXX function to call. |
1122 const GURL& url = source->GetOriginalURL(); | 1122 const GURL& url = source->GetOriginalURL(); |
1123 const net::URLRequestStatus& status = source->GetStatus(); | 1123 const net::URLRequestStatus& status = source->GetStatus(); |
1124 int response_code = source->GetResponseCode(); | 1124 int response_code = source->GetResponseCode(); |
1125 std::string data; | 1125 std::string data; |
1126 source->GetResponseAsString(&data); | 1126 source->GetResponseAsString(&data); |
1127 if (url == client_login_gurl_) { | 1127 if (url == client_login_gurl_) { |
(...skipping 21 matching lines...) Expand all Loading... |
1149 NOTREACHED(); | 1149 NOTREACHED(); |
1150 } | 1150 } |
1151 } | 1151 } |
1152 | 1152 |
1153 // static | 1153 // static |
1154 bool GaiaAuthFetcher::IsSecondFactorSuccess( | 1154 bool GaiaAuthFetcher::IsSecondFactorSuccess( |
1155 const std::string& alleged_error) { | 1155 const std::string& alleged_error) { |
1156 return alleged_error.find(kSecondFactor) != | 1156 return alleged_error.find(kSecondFactor) != |
1157 std::string::npos; | 1157 std::string::npos; |
1158 } | 1158 } |
OLD | NEW |