| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Stops any in-progress load and ensures no callback will happen. It is | 56 // Stops any in-progress load and ensures no callback will happen. It is |
| 57 // safe to call this multiple times. | 57 // safe to call this multiple times. |
| 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, |
| 67 const base::FilePath& file_path, |
| 68 scoped_refptr<base::TaskRunner> file_task_runner); |
| 66 void SetChunkedUpload(const std::string& upload_content_type); | 69 void SetChunkedUpload(const std::string& upload_content_type); |
| 67 // Adds a block of data to be uploaded in a POST body. This can only be | 70 // Adds a block of data to be uploaded in a POST body. This can only be |
| 68 // called after Start(). | 71 // called after Start(). |
| 69 void AppendChunkToUpload(const std::string& data, bool is_last_chunk); | 72 void AppendChunkToUpload(const std::string& data, bool is_last_chunk); |
| 70 // |flags| are flags to apply to the load operation--these should be | 73 // |flags| are flags to apply to the load operation--these should be |
| 71 // one or more of the LOAD_* flags defined in net/base/load_flags.h. | 74 // one or more of the LOAD_* flags defined in net/base/load_flags.h. |
| 72 void SetLoadFlags(int load_flags); | 75 void SetLoadFlags(int load_flags); |
| 73 int GetLoadFlags() const; | 76 int GetLoadFlags() const; |
| 74 void SetReferrer(const std::string& referrer); | 77 void SetReferrer(const std::string& referrer); |
| 75 void SetExtraRequestHeaders(const std::string& extra_request_headers); | 78 void SetExtraRequestHeaders(const std::string& extra_request_headers); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 const void* url_request_data_key_; | 244 const void* url_request_data_key_; |
| 242 URLFetcher::CreateDataCallback url_request_create_data_callback_; | 245 URLFetcher::CreateDataCallback url_request_create_data_callback_; |
| 243 ResponseCookies cookies_; // Response cookies | 246 ResponseCookies cookies_; // Response cookies |
| 244 HttpRequestHeaders extra_request_headers_; | 247 HttpRequestHeaders extra_request_headers_; |
| 245 scoped_refptr<HttpResponseHeaders> response_headers_; | 248 scoped_refptr<HttpResponseHeaders> response_headers_; |
| 246 bool was_fetched_via_proxy_; | 249 bool was_fetched_via_proxy_; |
| 247 HostPortPair socket_address_; | 250 HostPortPair socket_address_; |
| 248 | 251 |
| 249 bool upload_content_set_; // SetUploadData has been called | 252 bool upload_content_set_; // SetUploadData has been called |
| 250 std::string upload_content_; // HTTP POST payload | 253 std::string upload_content_; // HTTP POST payload |
| 254 base::FilePath upload_file_path_; // Path to file containing POST payload |
| 251 std::string upload_content_type_; // MIME type of POST payload | 255 std::string upload_content_type_; // MIME type of POST payload |
| 252 std::string referrer_; // HTTP Referer header value | 256 std::string referrer_; // HTTP Referer header value |
| 253 bool is_chunked_upload_; // True if using chunked transfer encoding | 257 bool is_chunked_upload_; // True if using chunked transfer encoding |
| 254 | 258 |
| 255 // Used to determine how long to wait before making a request or doing a | 259 // Used to determine how long to wait before making a request or doing a |
| 256 // retry. | 260 // retry. |
| 257 // | 261 // |
| 258 // Both of them can only be accessed on the IO thread. | 262 // Both of them can only be accessed on the IO thread. |
| 259 // | 263 // |
| 260 // We need not only the throttler entry for |original_URL|, but also | 264 // We need not only the throttler entry for |original_URL|, but also |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 base::debug::StackTrace stack_trace_; | 333 base::debug::StackTrace stack_trace_; |
| 330 | 334 |
| 331 static base::LazyInstance<Registry> g_registry; | 335 static base::LazyInstance<Registry> g_registry; |
| 332 | 336 |
| 333 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); | 337 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); |
| 334 }; | 338 }; |
| 335 | 339 |
| 336 } // namespace net | 340 } // namespace net |
| 337 | 341 |
| 338 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ | 342 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
| OLD | NEW |