Chromium Code Reviews| Index: chrome/common/net/gaia/gaia_auth_fetcher.cc |
| diff --git a/chrome/common/net/gaia/gaia_auth_fetcher.cc b/chrome/common/net/gaia/gaia_auth_fetcher.cc |
| index 5d34ed23ebe8de29ff037e05df50d241189985b5..64f71b1fccd2ca4183e6517ceb4d3d18ca1e492b 100644 |
| --- a/chrome/common/net/gaia/gaia_auth_fetcher.cc |
| +++ b/chrome/common/net/gaia/gaia_auth_fetcher.cc |
| @@ -507,25 +507,40 @@ void GaiaAuthFetcher::StartOAuthLoginTokenFetch( |
| const std::string& auth_token) { |
| DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; |
| - DVLOG(1) << "Starting OAuth login token fetch"; |
| + DVLOG(1) << "Starting OAuth login token fetch with auth_token"; |
| request_body_ = MakeGetAuthCodeBody(); |
| + client_login_to_oauth2_gurl_ = |
| + GURL(GaiaUrls::GetInstance()->client_login_to_oauth2_url()); |
| - // If no auth_token is given, then make sure to use the cookie jar with this |
| - // request. Otherwise the token contains all the necessary information and |
| - // the cookie jar should not be touched. |
| - int load_flags = net::LOAD_NORMAL; |
| - std::string auth_code_header = ""; |
| + fetcher_.reset(CreateGaiaFetcher(getter_, |
| + request_body_, |
| + MakeGetAuthCodeHeader(auth_token), |
| + client_login_to_oauth2_gurl_, |
| + kLoadFlagsIgnoreCookies, |
| + this)); |
| + fetch_pending_ = true; |
| + fetcher_->Start(); |
| +} |
| + |
| +void GaiaAuthFetcher::StartOAuthLoginTokenFetchWithCookies( |
| + const std::string& session_index) { |
| + DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; |
| - if (!auth_token.empty()) { |
| - load_flags = kLoadFlagsIgnoreCookies; |
| - auth_code_header = MakeGetAuthCodeHeader(auth_token); |
| + DVLOG(1) << "Starting OAuth login token fetch with cookie jar"; |
| + request_body_ = MakeGetAuthCodeBody(); |
| + |
| + std::string url = GaiaUrls::GetInstance()->client_login_to_oauth2_url(); |
| + if (!session_index.empty()) { |
| + url += "?authuser="; |
| + url += session_index; |
|
Andrew T Wilson (Slow)
2012/03/06 20:42:46
Can you do url += "?authuser=" + session_index; or
Roger Tawa OOO till Jul 10th
2012/03/06 21:25:17
Done.
|
| } |
| + client_login_to_oauth2_gurl_ = GURL(url); |
| fetcher_.reset(CreateGaiaFetcher(getter_, |
| request_body_, |
| - auth_code_header, |
| + "", |
| client_login_to_oauth2_gurl_, |
| - load_flags, |
| + net::LOAD_NORMAL, |
| this)); |
| fetch_pending_ = true; |
| fetcher_->Start(); |