| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 bool GaiaAuthFetcher::HasPendingFetch() { | 218 bool GaiaAuthFetcher::HasPendingFetch() { |
| 219 return fetch_pending_; | 219 return fetch_pending_; |
| 220 } | 220 } |
| 221 | 221 |
| 222 void GaiaAuthFetcher::CancelRequest() { | 222 void GaiaAuthFetcher::CancelRequest() { |
| 223 fetcher_.reset(); | 223 fetcher_.reset(); |
| 224 fetch_pending_ = false; | 224 fetch_pending_ = false; |
| 225 } | 225 } |
| 226 | 226 |
| 227 // static | 227 // static |
| 228 content::URLFetcher* GaiaAuthFetcher::CreateGaiaFetcher( | 228 net::URLFetcher* GaiaAuthFetcher::CreateGaiaFetcher( |
| 229 net::URLRequestContextGetter* getter, | 229 net::URLRequestContextGetter* getter, |
| 230 const std::string& body, | 230 const std::string& body, |
| 231 const std::string& headers, | 231 const std::string& headers, |
| 232 const GURL& gaia_gurl, | 232 const GURL& gaia_gurl, |
| 233 int load_flags, | 233 int load_flags, |
| 234 content::URLFetcherDelegate* delegate) { | 234 net::URLFetcherDelegate* delegate) { |
| 235 content::URLFetcher* to_return = content::URLFetcher::Create( | 235 net::URLFetcher* to_return = content::URLFetcher::Create( |
| 236 0, gaia_gurl, | 236 0, gaia_gurl, |
| 237 body == "" ? content::URLFetcher::GET : content::URLFetcher::POST, | 237 body == "" ? content::URLFetcher::GET : content::URLFetcher::POST, |
| 238 delegate); | 238 delegate); |
| 239 to_return->SetRequestContext(getter); | 239 to_return->SetRequestContext(getter); |
| 240 to_return->SetUploadData("application/x-www-form-urlencoded", body); | 240 to_return->SetUploadData("application/x-www-form-urlencoded", body); |
| 241 | 241 |
| 242 // The Gaia token exchange requests do not require any cookie-based | 242 // The Gaia token exchange requests do not require any cookie-based |
| 243 // identification as part of requests. We suppress sending any cookies to | 243 // identification as part of requests. We suppress sending any cookies to |
| 244 // maintain a separation between the user's browsing and Chrome's internal | 244 // maintain a separation between the user's browsing and Chrome's internal |
| 245 // services. Where such mixing is desired (MergeSession), it will be done | 245 // services. Where such mixing is desired (MergeSession), it will be done |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |