| 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/oauth2_api_call_flow.h" | 5 #include "google_apis/gaia/oauth2_api_call_flow.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/profiler/scoped_profile.h" | 11 #include "base/profiler/scoped_tracker.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "google_apis/gaia/gaia_urls.h" | 13 #include "google_apis/gaia/gaia_urls.h" |
| 14 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
| 15 #include "net/base/load_flags.h" | 15 #include "net/base/load_flags.h" |
| 16 #include "net/http/http_status_code.h" | 16 #include "net/http/http_status_code.h" |
| 17 #include "net/url_request/url_fetcher.h" | 17 #include "net/url_request/url_fetcher.h" |
| 18 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
| 19 #include "net/url_request/url_request_status.h" | 19 #include "net/url_request/url_request_status.h" |
| 20 | 20 |
| 21 using net::ResponseCookies; | 21 using net::ResponseCookies; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 state_ = API_CALL_DONE; | 60 state_ = API_CALL_DONE; |
| 61 ProcessApiCallSuccess(source); | 61 ProcessApiCallSuccess(source); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 std::string OAuth2ApiCallFlow::CreateApiCallBodyContentType() { | 65 std::string OAuth2ApiCallFlow::CreateApiCallBodyContentType() { |
| 66 return "application/x-www-form-urlencoded"; | 66 return "application/x-www-form-urlencoded"; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void OAuth2ApiCallFlow::OnURLFetchComplete(const net::URLFetcher* source) { | 69 void OAuth2ApiCallFlow::OnURLFetchComplete(const net::URLFetcher* source) { |
| 70 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. | 70 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422577 is fixed. |
| 71 tracked_objects::ScopedProfile tracking_profile( | 71 tracked_objects::ScopedTracker tracking_profile( |
| 72 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 72 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 73 "422577 OAuth2ApiCallFlow::OnURLFetchComplete")); | 73 "422577 OAuth2ApiCallFlow::OnURLFetchComplete")); |
| 74 | 74 |
| 75 CHECK(source); | 75 CHECK(source); |
| 76 CHECK_EQ(API_CALL_STARTED, state_); | 76 CHECK_EQ(API_CALL_STARTED, state_); |
| 77 EndApiCall(source); | 77 EndApiCall(source); |
| 78 } | 78 } |
| 79 | 79 |
| 80 URLFetcher* OAuth2ApiCallFlow::CreateURLFetcher( | 80 URLFetcher* OAuth2ApiCallFlow::CreateURLFetcher( |
| 81 net::URLRequestContextGetter* context, | 81 net::URLRequestContextGetter* context, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 96 // especially at startup and after sign-in on ChromeOS. Retrying once should | 96 // especially at startup and after sign-in on ChromeOS. Retrying once should |
| 97 // be enough in those cases; let the fetcher retry up to 3 times just in case. | 97 // be enough in those cases; let the fetcher retry up to 3 times just in case. |
| 98 // http://crbug.com/163710 | 98 // http://crbug.com/163710 |
| 99 result->SetAutomaticallyRetryOnNetworkChanges(3); | 99 result->SetAutomaticallyRetryOnNetworkChanges(3); |
| 100 | 100 |
| 101 if (!empty_body) | 101 if (!empty_body) |
| 102 result->SetUploadData(CreateApiCallBodyContentType(), body); | 102 result->SetUploadData(CreateApiCallBodyContentType(), body); |
| 103 | 103 |
| 104 return result; | 104 return result; |
| 105 } | 105 } |
| OLD | NEW |