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_CORE_H_ | 5 #ifndef NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
6 #define NET_URL_REQUEST_URL_FETCHER_CORE_H_ | 6 #define NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 void Stop(); | 58 void Stop(); |
59 | 59 |
60 // URLFetcher-like functions. | 60 // URLFetcher-like functions. |
61 | 61 |
62 // For POST requests, set |content_type| to the MIME type of the | 62 // For POST requests, set |content_type| to the MIME type of the |
63 // content and set |content| to the data to upload. | 63 // content and set |content| to the data to upload. |
64 void SetUploadData(const std::string& upload_content_type, | 64 void SetUploadData(const std::string& upload_content_type, |
65 const std::string& upload_content); | 65 const std::string& upload_content); |
66 void SetUploadFilePath(const std::string& upload_content_type, | 66 void SetUploadFilePath(const std::string& upload_content_type, |
67 const base::FilePath& file_path, | 67 const base::FilePath& file_path, |
| 68 uint64 range_offset, |
| 69 uint64 range_length, |
68 scoped_refptr<base::TaskRunner> file_task_runner); | 70 scoped_refptr<base::TaskRunner> file_task_runner); |
69 void SetChunkedUpload(const std::string& upload_content_type); | 71 void SetChunkedUpload(const std::string& upload_content_type); |
70 // Adds a block of data to be uploaded in a POST body. This can only be | 72 // Adds a block of data to be uploaded in a POST body. This can only be |
71 // called after Start(). | 73 // called after Start(). |
72 void AppendChunkToUpload(const std::string& data, bool is_last_chunk); | 74 void AppendChunkToUpload(const std::string& data, bool is_last_chunk); |
73 // |flags| are flags to apply to the load operation--these should be | 75 // |flags| are flags to apply to the load operation--these should be |
74 // one or more of the LOAD_* flags defined in net/base/load_flags.h. | 76 // one or more of the LOAD_* flags defined in net/base/load_flags.h. |
75 void SetLoadFlags(int load_flags); | 77 void SetLoadFlags(int load_flags); |
76 int GetLoadFlags() const; | 78 int GetLoadFlags() const; |
77 void SetReferrer(const std::string& referrer); | 79 void SetReferrer(const std::string& referrer); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 URLFetcher::CreateDataCallback url_request_create_data_callback_; | 240 URLFetcher::CreateDataCallback url_request_create_data_callback_; |
239 ResponseCookies cookies_; // Response cookies | 241 ResponseCookies cookies_; // Response cookies |
240 HttpRequestHeaders extra_request_headers_; | 242 HttpRequestHeaders extra_request_headers_; |
241 scoped_refptr<HttpResponseHeaders> response_headers_; | 243 scoped_refptr<HttpResponseHeaders> response_headers_; |
242 bool was_fetched_via_proxy_; | 244 bool was_fetched_via_proxy_; |
243 HostPortPair socket_address_; | 245 HostPortPair socket_address_; |
244 | 246 |
245 bool upload_content_set_; // SetUploadData has been called | 247 bool upload_content_set_; // SetUploadData has been called |
246 std::string upload_content_; // HTTP POST payload | 248 std::string upload_content_; // HTTP POST payload |
247 base::FilePath upload_file_path_; // Path to file containing POST payload | 249 base::FilePath upload_file_path_; // Path to file containing POST payload |
| 250 uint64 upload_range_offset_; // Offset from the beginning of the file |
| 251 // to be uploaded. |
| 252 uint64 upload_range_length_; // The length of the part of file to be |
| 253 // uploaded. |
248 std::string upload_content_type_; // MIME type of POST payload | 254 std::string upload_content_type_; // MIME type of POST payload |
249 std::string referrer_; // HTTP Referer header value | 255 std::string referrer_; // HTTP Referer header value |
250 bool is_chunked_upload_; // True if using chunked transfer encoding | 256 bool is_chunked_upload_; // True if using chunked transfer encoding |
251 | 257 |
252 // Used to determine how long to wait before making a request or doing a | 258 // Used to determine how long to wait before making a request or doing a |
253 // retry. | 259 // retry. |
254 // | 260 // |
255 // Both of them can only be accessed on the IO thread. | 261 // Both of them can only be accessed on the IO thread. |
256 // | 262 // |
257 // We need not only the throttler entry for |original_URL|, but also | 263 // We need not only the throttler entry for |original_URL|, but also |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 base::debug::StackTrace stack_trace_; | 337 base::debug::StackTrace stack_trace_; |
332 | 338 |
333 static base::LazyInstance<Registry> g_registry; | 339 static base::LazyInstance<Registry> g_registry; |
334 | 340 |
335 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); | 341 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); |
336 }; | 342 }; |
337 | 343 |
338 } // namespace net | 344 } // namespace net |
339 | 345 |
340 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ | 346 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
OLD | NEW |