| 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 "google_apis/gaia/gaia_auth_fetcher.h" | 5 #include "google_apis/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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 GaiaAuthFetcher::~GaiaAuthFetcher() {} | 188 GaiaAuthFetcher::~GaiaAuthFetcher() {} |
| 189 | 189 |
| 190 bool GaiaAuthFetcher::HasPendingFetch() { | 190 bool GaiaAuthFetcher::HasPendingFetch() { |
| 191 return fetch_pending_; | 191 return fetch_pending_; |
| 192 } | 192 } |
| 193 | 193 |
| 194 void GaiaAuthFetcher::SetPendingFetch(bool pending_fetch) { | 194 void GaiaAuthFetcher::SetPendingFetch(bool pending_fetch) { |
| 195 fetch_pending_ = pending_fetch; | 195 fetch_pending_ = pending_fetch; |
| 196 } | 196 } |
| 197 | 197 |
| 198 void GaiaAuthFetcher::SetLogoutHeaders(const std::string& headers) { |
| 199 logout_headers_ = headers; |
| 200 } |
| 201 |
| 198 void GaiaAuthFetcher::CancelRequest() { | 202 void GaiaAuthFetcher::CancelRequest() { |
| 199 fetcher_.reset(); | 203 fetcher_.reset(); |
| 200 fetch_pending_ = false; | 204 fetch_pending_ = false; |
| 201 } | 205 } |
| 202 | 206 |
| 203 void GaiaAuthFetcher::CreateAndStartGaiaFetcher(const std::string& body, | 207 void GaiaAuthFetcher::CreateAndStartGaiaFetcher(const std::string& body, |
| 204 const std::string& headers, | 208 const std::string& headers, |
| 205 const GURL& gaia_gurl, | 209 const GURL& gaia_gurl, |
| 206 int load_flags) { | 210 int load_flags) { |
| 207 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; | 211 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; | 626 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; |
| 623 | 627 |
| 624 CreateAndStartGaiaFetcher(" ", // To force an HTTP POST. | 628 CreateAndStartGaiaFetcher(" ", // To force an HTTP POST. |
| 625 "Origin: https://www.google.com", | 629 "Origin: https://www.google.com", |
| 626 list_accounts_gurl_, net::LOAD_NORMAL); | 630 list_accounts_gurl_, net::LOAD_NORMAL); |
| 627 } | 631 } |
| 628 | 632 |
| 629 void GaiaAuthFetcher::StartLogOut() { | 633 void GaiaAuthFetcher::StartLogOut() { |
| 630 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; | 634 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; |
| 631 | 635 |
| 632 CreateAndStartGaiaFetcher(std::string(), std::string(), logout_gurl_, | 636 CreateAndStartGaiaFetcher(std::string(), logout_headers_, logout_gurl_, |
| 633 net::LOAD_NORMAL); | 637 net::LOAD_NORMAL); |
| 634 } | 638 } |
| 635 | 639 |
| 636 void GaiaAuthFetcher::StartGetCheckConnectionInfo() { | 640 void GaiaAuthFetcher::StartGetCheckConnectionInfo() { |
| 637 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; | 641 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; |
| 638 | 642 |
| 639 CreateAndStartGaiaFetcher(std::string(), std::string(), | 643 CreateAndStartGaiaFetcher(std::string(), std::string(), |
| 640 get_check_connection_info_url_, | 644 get_check_connection_info_url_, |
| 641 kLoadFlagsIgnoreCookies); | 645 kLoadFlagsIgnoreCookies); |
| 642 } | 646 } |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 return alleged_error.find(kSecondFactor) != | 982 return alleged_error.find(kSecondFactor) != |
| 979 std::string::npos; | 983 std::string::npos; |
| 980 } | 984 } |
| 981 | 985 |
| 982 // static | 986 // static |
| 983 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( | 987 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( |
| 984 const std::string& alleged_error) { | 988 const std::string& alleged_error) { |
| 985 return alleged_error.find(kWebLoginRequired) != | 989 return alleged_error.find(kWebLoginRequired) != |
| 986 std::string::npos; | 990 std::string::npos; |
| 987 } | 991 } |
| OLD | NEW |