| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 219 |
| 217 URLFetcher* fetcher_; // Corresponding fetcher object | 220 URLFetcher* fetcher_; // Corresponding fetcher object |
| 218 GURL original_url_; // The URL we were asked to fetch | 221 GURL original_url_; // The URL we were asked to fetch |
| 219 GURL url_; // The URL we eventually wound up at | 222 GURL url_; // The URL we eventually wound up at |
| 220 URLFetcher::RequestType request_type_; // What type of request is this? | 223 URLFetcher::RequestType request_type_; // What type of request is this? |
| 221 URLRequestStatus status_; // Status of the request | 224 URLRequestStatus status_; // Status of the request |
| 222 URLFetcherDelegate* delegate_; // Object to notify on completion | 225 URLFetcherDelegate* delegate_; // Object to notify on completion |
| 223 scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner_; | 226 scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner_; |
| 224 // Task runner for the creating thread. | 227 // Task runner for the creating thread. |
| 225 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 228 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
| 226 // Task runner for file access. | 229 // Task runner for download file access. |
| 227 scoped_refptr<base::TaskRunner> file_task_runner_; | 230 scoped_refptr<base::TaskRunner> file_task_runner_; |
| 231 // Task runner for upload file access. |
| 232 scoped_refptr<base::TaskRunner> upload_file_task_runner_; |
| 228 // Task runner for the thread | 233 // Task runner for the thread |
| 229 // on which file access happens. | 234 // on which file access happens. |
| 230 scoped_ptr<URLRequest> request_; // The actual request this wraps | 235 scoped_ptr<URLRequest> request_; // The actual request this wraps |
| 231 int load_flags_; // Flags for the load operation | 236 int load_flags_; // Flags for the load operation |
| 232 int response_code_; // HTTP status code for the request | 237 int response_code_; // HTTP status code for the request |
| 233 std::string data_; // Results of the request, when we are | 238 std::string data_; // Results of the request, when we are |
| 234 // storing the response as a string. | 239 // storing the response as a string. |
| 235 scoped_refptr<IOBuffer> buffer_; | 240 scoped_refptr<IOBuffer> buffer_; |
| 236 // Read buffer | 241 // Read buffer |
| 237 scoped_refptr<URLRequestContextGetter> request_context_getter_; | 242 scoped_refptr<URLRequestContextGetter> request_context_getter_; |
| 238 // Cookie/cache info for the request | 243 // Cookie/cache info for the request |
| 239 GURL first_party_for_cookies_; // The first party URL for the request | 244 GURL first_party_for_cookies_; // The first party URL for the request |
| 240 // The user data to add to each newly-created URLRequest. | 245 // The user data to add to each newly-created URLRequest. |
| 241 const void* url_request_data_key_; | 246 const void* url_request_data_key_; |
| 242 URLFetcher::CreateDataCallback url_request_create_data_callback_; | 247 URLFetcher::CreateDataCallback url_request_create_data_callback_; |
| 243 ResponseCookies cookies_; // Response cookies | 248 ResponseCookies cookies_; // Response cookies |
| 244 HttpRequestHeaders extra_request_headers_; | 249 HttpRequestHeaders extra_request_headers_; |
| 245 scoped_refptr<HttpResponseHeaders> response_headers_; | 250 scoped_refptr<HttpResponseHeaders> response_headers_; |
| 246 bool was_fetched_via_proxy_; | 251 bool was_fetched_via_proxy_; |
| 247 HostPortPair socket_address_; | 252 HostPortPair socket_address_; |
| 248 | 253 |
| 249 bool upload_content_set_; // SetUploadData has been called | 254 bool upload_content_set_; // SetUploadData has been called |
| 250 std::string upload_content_; // HTTP POST payload | 255 std::string upload_content_; // HTTP POST payload |
| 256 base::FilePath upload_file_path_; // Path to file containing POST payload |
| 251 std::string upload_content_type_; // MIME type of POST payload | 257 std::string upload_content_type_; // MIME type of POST payload |
| 252 std::string referrer_; // HTTP Referer header value | 258 std::string referrer_; // HTTP Referer header value |
| 253 bool is_chunked_upload_; // True if using chunked transfer encoding | 259 bool is_chunked_upload_; // True if using chunked transfer encoding |
| 254 | 260 |
| 255 // Used to determine how long to wait before making a request or doing a | 261 // Used to determine how long to wait before making a request or doing a |
| 256 // retry. | 262 // retry. |
| 257 // | 263 // |
| 258 // Both of them can only be accessed on the IO thread. | 264 // Both of them can only be accessed on the IO thread. |
| 259 // | 265 // |
| 260 // We need not only the throttler entry for |original_URL|, but also | 266 // 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_; | 335 base::debug::StackTrace stack_trace_; |
| 330 | 336 |
| 331 static base::LazyInstance<Registry> g_registry; | 337 static base::LazyInstance<Registry> g_registry; |
| 332 | 338 |
| 333 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); | 339 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); |
| 334 }; | 340 }; |
| 335 | 341 |
| 336 } // namespace net | 342 } // namespace net |
| 337 | 343 |
| 338 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ | 344 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
| OLD | NEW |