| 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_oauth_client.h" | 5 #include "google_apis/gaia/gaia_oauth_client.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/profiler/scoped_profile.h" |
| 10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 11 #include "base/values.h" | 12 #include "base/values.h" |
| 12 #include "google_apis/gaia/gaia_urls.h" | 13 #include "google_apis/gaia/gaia_urls.h" |
| 13 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
| 14 #include "net/base/load_flags.h" | 15 #include "net/base/load_flags.h" |
| 15 #include "net/http/http_status_code.h" | 16 #include "net/http/http_status_code.h" |
| 16 #include "net/url_request/url_fetcher.h" | 17 #include "net/url_request/url_fetcher.h" |
| 17 #include "net/url_request/url_fetcher_delegate.h" | 18 #include "net/url_request/url_fetcher_delegate.h" |
| 18 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 request_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 220 request_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 220 net::LOAD_DO_NOT_SAVE_COOKIES); | 221 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 221 // See comment on SetAutomaticallyRetryOnNetworkChanges() above. | 222 // See comment on SetAutomaticallyRetryOnNetworkChanges() above. |
| 222 request_->SetAutomaticallyRetryOnNetworkChanges(3); | 223 request_->SetAutomaticallyRetryOnNetworkChanges(3); |
| 223 request_->Start(); | 224 request_->Start(); |
| 224 } | 225 } |
| 225 | 226 |
| 226 // URLFetcher::Delegate implementation. | 227 // URLFetcher::Delegate implementation. |
| 227 void GaiaOAuthClient::Core::OnURLFetchComplete( | 228 void GaiaOAuthClient::Core::OnURLFetchComplete( |
| 228 const net::URLFetcher* source) { | 229 const net::URLFetcher* source) { |
| 230 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. |
| 231 tracked_objects::ScopedProfile tracking_profile( |
| 232 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 233 "422577 GaiaOAuthClient::Core::OnURLFetchComplete")); |
| 234 |
| 229 bool should_retry = false; | 235 bool should_retry = false; |
| 230 HandleResponse(source, &should_retry); | 236 HandleResponse(source, &should_retry); |
| 231 if (should_retry) { | 237 if (should_retry) { |
| 232 // Explicitly call ReceivedContentWasMalformed() to ensure the current | 238 // Explicitly call ReceivedContentWasMalformed() to ensure the current |
| 233 // request gets counted as a failure for calculation of the back-off | 239 // request gets counted as a failure for calculation of the back-off |
| 234 // period. If it was already a failure by status code, this call will | 240 // period. If it was already a failure by status code, this call will |
| 235 // be ignored. | 241 // be ignored. |
| 236 request_->ReceivedContentWasMalformed(); | 242 request_->ReceivedContentWasMalformed(); |
| 237 num_retries_++; | 243 num_retries_++; |
| 238 // We must set our request_context_getter_ again because | 244 // We must set our request_context_getter_ again because |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 return core_->GetUserInfo(access_token, max_retries, delegate); | 399 return core_->GetUserInfo(access_token, max_retries, delegate); |
| 394 } | 400 } |
| 395 | 401 |
| 396 void GaiaOAuthClient::GetTokenInfo(const std::string& access_token, | 402 void GaiaOAuthClient::GetTokenInfo(const std::string& access_token, |
| 397 int max_retries, | 403 int max_retries, |
| 398 Delegate* delegate) { | 404 Delegate* delegate) { |
| 399 return core_->GetTokenInfo(access_token, max_retries, delegate); | 405 return core_->GetTokenInfo(access_token, max_retries, delegate); |
| 400 } | 406 } |
| 401 | 407 |
| 402 } // namespace gaia | 408 } // namespace gaia |
| OLD | NEW |