OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains URLFetcher, a wrapper around URLRequest that handles | 5 // This file contains URLFetcher, a wrapper around URLRequest that handles |
6 // low-level details like thread safety, ref counting, and incremental buffer | 6 // low-level details like thread safety, ref counting, and incremental buffer |
7 // reading. This is useful for callers who simply want to get the data from a | 7 // reading. This is useful for callers who simply want to get the data from a |
8 // URL and don't care about all the nitty-gritty details. | 8 // URL and don't care about all the nitty-gritty details. |
9 | 9 |
10 #ifndef CHROME_COMMON_NET_URL_FETCHER_H_ | 10 #ifndef CHROME_COMMON_NET_URL_FETCHER_H_ |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 void set_extra_request_headers(const std::string& extra_request_headers); | 139 void set_extra_request_headers(const std::string& extra_request_headers); |
140 | 140 |
141 // Set the URLRequestContext on the request. Must be called before the | 141 // Set the URLRequestContext on the request. Must be called before the |
142 // request is started. | 142 // request is started. |
143 void set_request_context( | 143 void set_request_context( |
144 URLRequestContextGetter* request_context_getter); | 144 URLRequestContextGetter* request_context_getter); |
145 | 145 |
146 // If |retry| is false, 5xx responses will be propagated to the observer, | 146 // If |retry| is false, 5xx responses will be propagated to the observer, |
147 // if it is true URLFetcher will automatically re-execute the request, | 147 // if it is true URLFetcher will automatically re-execute the request, |
148 // after backoff_delay() elapses. URLFetcher has it set to true by default. | 148 // after backoff_delay() elapses. URLFetcher has it set to true by default. |
149 void set_automatcally_retry_on_5xx(bool retry); | 149 void set_automatically_retry_on_5xx(bool retry); |
150 | 150 |
151 // Returns the back-off delay before the request will be retried, | 151 // Returns the back-off delay before the request will be retried, |
152 // when a 5xx response was received. | 152 // when a 5xx response was received. |
153 base::TimeDelta backoff_delay() const { return backoff_delay_; } | 153 base::TimeDelta backoff_delay() const { return backoff_delay_; } |
154 | 154 |
155 // Sets the back-off delay, allowing to mock 5xx requests in unit-tests. | 155 // Sets the back-off delay, allowing to mock 5xx requests in unit-tests. |
156 #if defined(UNIT_TEST) | 156 #if defined(UNIT_TEST) |
157 void set_backoff_delay(base::TimeDelta backoff_delay) { | 157 void set_backoff_delay(base::TimeDelta backoff_delay) { |
158 backoff_delay_ = backoff_delay; | 158 backoff_delay_ = backoff_delay; |
159 } | 159 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 bool automatically_retry_on_5xx_; | 191 bool automatically_retry_on_5xx_; |
192 // Back-off time delay. 0 by default. | 192 // Back-off time delay. 0 by default. |
193 base::TimeDelta backoff_delay_; | 193 base::TimeDelta backoff_delay_; |
194 | 194 |
195 static bool g_interception_enabled; | 195 static bool g_interception_enabled; |
196 | 196 |
197 DISALLOW_COPY_AND_ASSIGN(URLFetcher); | 197 DISALLOW_COPY_AND_ASSIGN(URLFetcher); |
198 }; | 198 }; |
199 | 199 |
200 #endif // CHROME_COMMON_NET_URL_FETCHER_H_ | 200 #endif // CHROME_COMMON_NET_URL_FETCHER_H_ |
OLD | NEW |