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 #ifndef NET_URL_REQUEST_URL_FETCHER_H_ | 5 #ifndef NET_URL_REQUEST_URL_FETCHER_H_ |
6 #define NET_URL_REQUEST_URL_FETCHER_H_ | 6 #define NET_URL_REQUEST_URL_FETCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 const void* key, | 208 const void* key, |
209 const CreateDataCallback& create_data_callback) = 0; | 209 const CreateDataCallback& create_data_callback) = 0; |
210 | 210 |
211 // If |stop_on_redirect| is true, 3xx responses will cause the fetch to halt | 211 // If |stop_on_redirect| is true, 3xx responses will cause the fetch to halt |
212 // immediately rather than continue through the redirect. OnURLFetchComplete | 212 // immediately rather than continue through the redirect. OnURLFetchComplete |
213 // will be called, with the URLFetcher's URL set to the redirect destination, | 213 // will be called, with the URLFetcher's URL set to the redirect destination, |
214 // its status set to CANCELED, and its response code set to the relevant 3xx | 214 // its status set to CANCELED, and its response code set to the relevant 3xx |
215 // server response code. | 215 // server response code. |
216 virtual void SetStopOnRedirect(bool stop_on_redirect) = 0; | 216 virtual void SetStopOnRedirect(bool stop_on_redirect) = 0; |
217 | 217 |
218 // If |retry| is false, 5xx responses will be propagated to the observer, | 218 // If |retry| is false, 5xx responses will be propagated to the observer. If |
219 // if it is true URLFetcher will automatically re-execute the request, | 219 // it is true URLFetcher will automatically re-execute the request, after |
220 // after backoff_delay() elapses. URLFetcher has it set to true by default. | 220 // backoff_delay() elapses, up to the maximum number of retries allowed by |
| 221 // SetMaxRetriesOn5xx. Defaults to true. |
221 virtual void SetAutomaticallyRetryOn5xx(bool retry) = 0; | 222 virtual void SetAutomaticallyRetryOn5xx(bool retry) = 0; |
222 | 223 |
| 224 // |max_retries| is the maximum number of times URLFetcher will retry a |
| 225 // request that receives a 5XX response. Depends on |
| 226 // SetAutomaticallyRetryOn5xx. Defaults to 0. |
223 virtual void SetMaxRetriesOn5xx(int max_retries) = 0; | 227 virtual void SetMaxRetriesOn5xx(int max_retries) = 0; |
224 virtual int GetMaxRetriesOn5xx() const = 0; | 228 virtual int GetMaxRetriesOn5xx() const = 0; |
225 | 229 |
226 // Returns the back-off delay before the request will be retried, | 230 // Returns the back-off delay before the request will be retried, |
227 // when a 5xx response was received. | 231 // when a 5xx response was received. |
228 virtual base::TimeDelta GetBackoffDelay() const = 0; | 232 virtual base::TimeDelta GetBackoffDelay() const = 0; |
229 | 233 |
230 // Retries up to |max_retries| times when requests fail with | 234 // Retries up to |max_retries| times when requests fail with |
231 // ERR_NETWORK_CHANGED. If ERR_NETWORK_CHANGED is received after having | 235 // ERR_NETWORK_CHANGED. If ERR_NETWORK_CHANGED is received after having |
232 // retried |max_retries| times then it is propagated to the observer. | 236 // retried |max_retries| times then it is propagated to the observer. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // be removed once the URLFetcher is destroyed. User should not take | 306 // be removed once the URLFetcher is destroyed. User should not take |
303 // ownership more than once, or call this method after taking ownership. | 307 // ownership more than once, or call this method after taking ownership. |
304 virtual bool GetResponseAsFilePath( | 308 virtual bool GetResponseAsFilePath( |
305 bool take_ownership, | 309 bool take_ownership, |
306 base::FilePath* out_response_path) const = 0; | 310 base::FilePath* out_response_path) const = 0; |
307 }; | 311 }; |
308 | 312 |
309 } // namespace net | 313 } // namespace net |
310 | 314 |
311 #endif // NET_URL_REQUEST_URL_FETCHER_H_ | 315 #endif // NET_URL_REQUEST_URL_FETCHER_H_ |
OLD | NEW |