| 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/supports_user_data.h" | 14 #include "base/supports_user_data.h" |
| 15 #include "base/task_runner.h" | |
| 16 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
| 17 | 16 |
| 18 class GURL; | 17 class GURL; |
| 19 | 18 |
| 20 namespace base { | 19 namespace base { |
| 21 class FilePath; | 20 class FilePath; |
| 22 class MessageLoopProxy; | 21 class MessageLoopProxy; |
| 22 class SequencedTaskRunner; |
| 23 class TaskRunner; |
| 23 class TimeDelta; | 24 class TimeDelta; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace net { | 27 namespace net { |
| 27 class HostPortPair; | 28 class HostPortPair; |
| 28 class HttpRequestHeaders; | 29 class HttpRequestHeaders; |
| 29 class HttpResponseHeaders; | 30 class HttpResponseHeaders; |
| 30 class URLFetcherDelegate; | 31 class URLFetcherDelegate; |
| 31 class URLFetcherResponseWriter; | 32 class URLFetcherResponseWriter; |
| 32 class URLRequestContextGetter; | 33 class URLRequestContextGetter; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 virtual void SetAutomaticallyRetryOnNetworkChanges(int max_retries) = 0; | 225 virtual void SetAutomaticallyRetryOnNetworkChanges(int max_retries) = 0; |
| 225 | 226 |
| 226 // By default, the response is saved in a string. Call this method to save the | 227 // By default, the response is saved in a string. Call this method to save the |
| 227 // response to a file instead. Must be called before Start(). | 228 // response to a file instead. Must be called before Start(). |
| 228 // |file_task_runner| will be used for all file operations. | 229 // |file_task_runner| will be used for all file operations. |
| 229 // To save to a temporary file, use SaveResponseToTemporaryFile(). | 230 // To save to a temporary file, use SaveResponseToTemporaryFile(). |
| 230 // The created file is removed when the URLFetcher is deleted unless you | 231 // The created file is removed when the URLFetcher is deleted unless you |
| 231 // take ownership by calling GetResponseAsFilePath(). | 232 // take ownership by calling GetResponseAsFilePath(). |
| 232 virtual void SaveResponseToFileAtPath( | 233 virtual void SaveResponseToFileAtPath( |
| 233 const base::FilePath& file_path, | 234 const base::FilePath& file_path, |
| 234 scoped_refptr<base::TaskRunner> file_task_runner) = 0; | 235 scoped_refptr<base::SequencedTaskRunner> file_task_runner) = 0; |
| 235 | 236 |
| 236 // By default, the response is saved in a string. Call this method to save the | 237 // By default, the response is saved in a string. Call this method to save the |
| 237 // response to a temporary file instead. Must be called before Start(). | 238 // response to a temporary file instead. Must be called before Start(). |
| 238 // |file_task_runner| will be used for all file operations. | 239 // |file_task_runner| will be used for all file operations. |
| 239 // The created file is removed when the URLFetcher is deleted unless you | 240 // The created file is removed when the URLFetcher is deleted unless you |
| 240 // take ownership by calling GetResponseAsFilePath(). | 241 // take ownership by calling GetResponseAsFilePath(). |
| 241 virtual void SaveResponseToTemporaryFile( | 242 virtual void SaveResponseToTemporaryFile( |
| 242 scoped_refptr<base::TaskRunner> file_task_runner) = 0; | 243 scoped_refptr<base::SequencedTaskRunner> file_task_runner) = 0; |
| 243 | 244 |
| 244 // By default, the response is saved in a string. Call this method to use the | 245 // By default, the response is saved in a string. Call this method to use the |
| 245 // specified writer to save the response. Must be called before Start(). | 246 // specified writer to save the response. Must be called before Start(). |
| 246 virtual void SaveResponseWithWriter( | 247 virtual void SaveResponseWithWriter( |
| 247 scoped_ptr<URLFetcherResponseWriter> response_writer) = 0; | 248 scoped_ptr<URLFetcherResponseWriter> response_writer) = 0; |
| 248 | 249 |
| 249 // Retrieve the response headers from the request. Must only be called after | 250 // Retrieve the response headers from the request. Must only be called after |
| 250 // the OnURLFetchComplete callback has run. | 251 // the OnURLFetchComplete callback has run. |
| 251 virtual HttpResponseHeaders* GetResponseHeaders() const = 0; | 252 virtual HttpResponseHeaders* GetResponseHeaders() const = 0; |
| 252 | 253 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // be removed once the URLFetcher is destroyed. User should not take | 294 // be removed once the URLFetcher is destroyed. User should not take |
| 294 // ownership more than once, or call this method after taking ownership. | 295 // ownership more than once, or call this method after taking ownership. |
| 295 virtual bool GetResponseAsFilePath( | 296 virtual bool GetResponseAsFilePath( |
| 296 bool take_ownership, | 297 bool take_ownership, |
| 297 base::FilePath* out_response_path) const = 0; | 298 base::FilePath* out_response_path) const = 0; |
| 298 }; | 299 }; |
| 299 | 300 |
| 300 } // namespace net | 301 } // namespace net |
| 301 | 302 |
| 302 #endif // NET_URL_REQUEST_URL_FETCHER_H_ | 303 #endif // NET_URL_REQUEST_URL_FETCHER_H_ |
| OLD | NEW |