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_revocation_fetcher.h" | 5 #include "google_apis/gaia/oauth2_revocation_fetcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 URLFetcherDelegate* delegate) { | 55 URLFetcherDelegate* delegate) { |
56 bool empty_body = body.empty(); | 56 bool empty_body = body.empty(); |
57 URLFetcher* result = net::URLFetcher::Create( | 57 URLFetcher* result = net::URLFetcher::Create( |
58 0, url, | 58 0, url, |
59 empty_body ? URLFetcher::GET : URLFetcher::POST, | 59 empty_body ? URLFetcher::GET : URLFetcher::POST, |
60 delegate); | 60 delegate); |
61 | 61 |
62 result->SetRequestContext(getter); | 62 result->SetRequestContext(getter); |
63 result->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 63 result->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
64 net::LOAD_DO_NOT_SAVE_COOKIES); | 64 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 65 // Fetchers are sometimes cancelled because a network change was detected, |
| 66 // especially at startup and after sign-in on ChromeOS. Retrying once should |
| 67 // be enough in those cases; let the fetcher retry up to 3 times just in case. |
| 68 // http://crbug.com/163710 |
| 69 result->SetAutomaticallyRetryOnNetworkChanges(3); |
65 if (!header.empty()) | 70 if (!header.empty()) |
66 result->SetExtraRequestHeaders(header); | 71 result->SetExtraRequestHeaders(header); |
67 | 72 |
68 if (!empty_body) | 73 if (!empty_body) |
69 result->SetUploadData("application/x-www-form-urlencoded", body); | 74 result->SetUploadData("application/x-www-form-urlencoded", body); |
70 | 75 |
71 return result; | 76 return result; |
72 } | 77 } |
73 } // namespace | 78 } // namespace |
74 | 79 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 std::string OAuth2RevocationFetcher::MakeRevocationBody( | 161 std::string OAuth2RevocationFetcher::MakeRevocationBody( |
157 const std::string& client_id, | 162 const std::string& client_id, |
158 const std::string& origin) { | 163 const std::string& origin) { |
159 std::string enc_client_id = net::EscapeUrlEncodedData(client_id, true); | 164 std::string enc_client_id = net::EscapeUrlEncodedData(client_id, true); |
160 std::string enc_origin = net::EscapeUrlEncodedData(origin, true); | 165 std::string enc_origin = net::EscapeUrlEncodedData(origin, true); |
161 return StringPrintf( | 166 return StringPrintf( |
162 kRevocationBodyFormat, | 167 kRevocationBodyFormat, |
163 enc_client_id.c_str(), | 168 enc_client_id.c_str(), |
164 enc_origin.c_str()); | 169 enc_origin.c_str()); |
165 } | 170 } |
OLD | NEW |