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_REQUEST_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 class UploadDataStream; | 55 class UploadDataStream; |
56 class URLRequestContext; | 56 class URLRequestContext; |
57 class URLRequestJob; | 57 class URLRequestJob; |
58 class X509Certificate; | 58 class X509Certificate; |
59 | 59 |
60 // This stores the values of the Set-Cookie headers received during the request. | 60 // This stores the values of the Set-Cookie headers received during the request. |
61 // Each item in the vector corresponds to a Set-Cookie: line received, | 61 // Each item in the vector corresponds to a Set-Cookie: line received, |
62 // excluding the "Set-Cookie:" part. | 62 // excluding the "Set-Cookie:" part. |
63 typedef std::vector<std::string> ResponseCookies; | 63 typedef std::vector<std::string> ResponseCookies; |
64 | 64 |
| 65 // The LoFi state which determines whether to add the LoFi header. Must stay |
| 66 // in sync with the enum in navigation_params.h. |
| 67 enum LoFiState { |
| 68 // Request a LoFi version of the resource. |
| 69 LOFI_ON = 0, |
| 70 // Request a normal (non-LoFi) version of the resource. |
| 71 LOFI_OFF, |
| 72 // Let the browser process decide whether or not to request the LoFi version. |
| 73 LOFI_DEFAULT, |
| 74 }; |
| 75 |
65 //----------------------------------------------------------------------------- | 76 //----------------------------------------------------------------------------- |
66 // A class representing the asynchronous load of a data stream from an URL. | 77 // A class representing the asynchronous load of a data stream from an URL. |
67 // | 78 // |
68 // The lifetime of an instance of this class is completely controlled by the | 79 // The lifetime of an instance of this class is completely controlled by the |
69 // consumer, and the instance is not required to live on the heap or be | 80 // consumer, and the instance is not required to live on the heap or be |
70 // allocated in any special way. It is also valid to delete an URLRequest | 81 // allocated in any special way. It is also valid to delete an URLRequest |
71 // object during the handling of a callback to its delegate. Of course, once | 82 // object during the handling of a callback to its delegate. Of course, once |
72 // the URLRequest is deleted, no further callbacks to its delegate will occur. | 83 // the URLRequest is deleted, no further callbacks to its delegate will occur. |
73 // | 84 // |
74 // NOTE: All usage of all instances of this class should be on the same thread. | 85 // NOTE: All usage of all instances of this class should be on the same thread. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 304 |
294 // The referrer policy to apply when updating the referrer during redirects. | 305 // The referrer policy to apply when updating the referrer during redirects. |
295 // The referrer policy may only be changed before Start() is called. | 306 // The referrer policy may only be changed before Start() is called. |
296 ReferrerPolicy referrer_policy() const { return referrer_policy_; } | 307 ReferrerPolicy referrer_policy() const { return referrer_policy_; } |
297 void set_referrer_policy(ReferrerPolicy referrer_policy); | 308 void set_referrer_policy(ReferrerPolicy referrer_policy); |
298 | 309 |
299 // Sets the delegate of the request. This value may be changed at any time, | 310 // Sets the delegate of the request. This value may be changed at any time, |
300 // and it is permissible for it to be null. | 311 // and it is permissible for it to be null. |
301 void set_delegate(Delegate* delegate); | 312 void set_delegate(Delegate* delegate); |
302 | 313 |
| 314 // Whether or not to request a LoFi version of the resource or let the |
| 315 // browser decide. |
| 316 LoFiState lofi_state() const { return lofi_state_; } |
| 317 void set_lofi_state(LoFiState lofi_state); |
| 318 |
303 // Indicates that the request body should be sent using chunked transfer | 319 // Indicates that the request body should be sent using chunked transfer |
304 // encoding. This method may only be called before Start() is called. | 320 // encoding. This method may only be called before Start() is called. |
305 void EnableChunkedUpload(); | 321 void EnableChunkedUpload(); |
306 | 322 |
307 // Appends the given bytes to the request's upload data to be sent | 323 // Appends the given bytes to the request's upload data to be sent |
308 // immediately via chunked transfer encoding. When all data has been added, | 324 // immediately via chunked transfer encoding. When all data has been added, |
309 // set |is_last_chunk| to true to indicate the end of upload data. All chunks | 325 // set |is_last_chunk| to true to indicate the end of upload data. All chunks |
310 // but the last must have |bytes_len| > 0. | 326 // but the last must have |bytes_len| > 0. |
311 // | 327 // |
312 // This method may be called only after calling EnableChunkedUpload(). | 328 // This method may be called only after calling EnableChunkedUpload(). |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 LoadTimingInfo load_timing_info_; | 847 LoadTimingInfo load_timing_info_; |
832 | 848 |
833 // Keeps track of whether or not OnBeforeNetworkStart has been called yet. | 849 // Keeps track of whether or not OnBeforeNetworkStart has been called yet. |
834 bool notified_before_network_start_; | 850 bool notified_before_network_start_; |
835 | 851 |
836 // The proxy server used for this request, if any. | 852 // The proxy server used for this request, if any. |
837 HostPortPair proxy_server_; | 853 HostPortPair proxy_server_; |
838 | 854 |
839 scoped_ptr<const base::debug::StackTrace> stack_trace_; | 855 scoped_ptr<const base::debug::StackTrace> stack_trace_; |
840 | 856 |
| 857 // Whether or not to request a LoFi version of the resource or let the |
| 858 // browser decide. |
| 859 LoFiState lofi_state_; |
| 860 |
841 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 861 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
842 }; | 862 }; |
843 | 863 |
844 } // namespace net | 864 } // namespace net |
845 | 865 |
846 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 866 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
OLD | NEW |