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 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
15 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
16 #include "base/task_runner.h" | 16 #include "base/task_runner.h" |
17 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
18 | 18 |
19 class FilePath; | |
20 class GURL; | 19 class GURL; |
21 | 20 |
22 namespace base { | 21 namespace base { |
| 22 class FilePath; |
23 class MessageLoopProxy; | 23 class MessageLoopProxy; |
24 class TimeDelta; | 24 class TimeDelta; |
25 } | 25 } |
26 | 26 |
27 namespace net { | 27 namespace net { |
28 class HostPortPair; | 28 class HostPortPair; |
29 class HttpRequestHeaders; | 29 class HttpRequestHeaders; |
30 class HttpResponseHeaders; | 30 class HttpResponseHeaders; |
31 class UploadDataStream; | 31 class UploadDataStream; |
32 class URLFetcherDelegate; | 32 class URLFetcherDelegate; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // retried |max_retries| times then it is propagated to the observer. | 213 // retried |max_retries| times then it is propagated to the observer. |
214 virtual void SetAutomaticallyRetryOnNetworkChanges(int max_retries) = 0; | 214 virtual void SetAutomaticallyRetryOnNetworkChanges(int max_retries) = 0; |
215 | 215 |
216 // By default, the response is saved in a string. Call this method to save the | 216 // By default, the response is saved in a string. Call this method to save the |
217 // response to a file instead. Must be called before Start(). | 217 // response to a file instead. Must be called before Start(). |
218 // |file_task_runner| will be used for all file operations. | 218 // |file_task_runner| will be used for all file operations. |
219 // To save to a temporary file, use SaveResponseToTemporaryFile(). | 219 // To save to a temporary file, use SaveResponseToTemporaryFile(). |
220 // The created file is removed when the URLFetcher is deleted unless you | 220 // The created file is removed when the URLFetcher is deleted unless you |
221 // take ownership by calling GetResponseAsFilePath(). | 221 // take ownership by calling GetResponseAsFilePath(). |
222 virtual void SaveResponseToFileAtPath( | 222 virtual void SaveResponseToFileAtPath( |
223 const FilePath& file_path, | 223 const base::FilePath& file_path, |
224 scoped_refptr<base::TaskRunner> file_task_runner) = 0; | 224 scoped_refptr<base::TaskRunner> file_task_runner) = 0; |
225 | 225 |
226 // By default, the response is saved in a string. Call this method to save the | 226 // By default, the response is saved in a string. Call this method to save the |
227 // response to a temporary file instead. Must be called before Start(). | 227 // response to a temporary file instead. Must be called before Start(). |
228 // |file_task_runner| will be used for all file operations. | 228 // |file_task_runner| will be used for all file operations. |
229 // The created file is removed when the URLFetcher is deleted unless you | 229 // The created file is removed when the URLFetcher is deleted unless you |
230 // take ownership by calling GetResponseAsFilePath(). | 230 // take ownership by calling GetResponseAsFilePath(). |
231 virtual void SaveResponseToTemporaryFile( | 231 virtual void SaveResponseToTemporaryFile( |
232 scoped_refptr<base::TaskRunner> file_task_runner) = 0; | 232 scoped_refptr<base::TaskRunner> file_task_runner) = 0; |
233 | 233 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // Get the response as a string. Return false if the fetcher was not | 277 // Get the response as a string. Return false if the fetcher was not |
278 // set to store the response as a string. | 278 // set to store the response as a string. |
279 virtual bool GetResponseAsString(std::string* out_response_string) const = 0; | 279 virtual bool GetResponseAsString(std::string* out_response_string) const = 0; |
280 | 280 |
281 // Get the path to the file containing the response body. Returns false | 281 // Get the path to the file containing the response body. Returns false |
282 // if the response body was not saved to a file. If take_ownership is | 282 // if the response body was not saved to a file. If take_ownership is |
283 // true, caller takes responsibility for the file, and it will not | 283 // true, caller takes responsibility for the file, and it will not |
284 // be removed once the URLFetcher is destroyed. User should not take | 284 // be removed once the URLFetcher is destroyed. User should not take |
285 // ownership more than once, or call this method after taking ownership. | 285 // ownership more than once, or call this method after taking ownership. |
286 virtual bool GetResponseAsFilePath(bool take_ownership, | 286 virtual bool GetResponseAsFilePath(bool take_ownership, |
287 FilePath* out_response_path) const = 0; | 287 base::FilePath* out_response_path) const =
0; |
288 }; | 288 }; |
289 | 289 |
290 } // namespace net | 290 } // namespace net |
291 | 291 |
292 #endif // NET_URL_REQUEST_URL_FETCHER_H_ | 292 #endif // NET_URL_REQUEST_URL_FETCHER_H_ |
OLD | NEW |