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