| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 // Returns the cookie values included in the response, if applicable. | 99 // Returns the cookie values included in the response, if applicable. |
| 100 // Returns true if applicable. | 100 // Returns true if applicable. |
| 101 // NOTE: This removes the cookies from the job, so it will only return | 101 // NOTE: This removes the cookies from the job, so it will only return |
| 102 // useful results once per job. | 102 // useful results once per job. |
| 103 virtual bool GetResponseCookies(std::vector<std::string>* cookies) { | 103 virtual bool GetResponseCookies(std::vector<std::string>* cookies) { |
| 104 return false; | 104 return false; |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Returns the HTTP response code for the request. | 107 // Returns the HTTP response code for the request. |
| 108 virtual int GetResponseCode() { return -1; } | 108 virtual int GetResponseCode() const { return -1; } |
| 109 | 109 |
| 110 // Called to fetch the encoding types for this request. Only makes sense for | 110 // Called to fetch the encoding types for this request. Only makes sense for |
| 111 // some types of requests. Returns true on success. Calling this on a request | 111 // some types of requests. Returns true on success. Calling this on a request |
| 112 // that doesn't have or specify an encoding type will return false. | 112 // that doesn't have or specify an encoding type will return false. |
| 113 // Returns a array of strings showing the sequential encodings used on the | 113 // Returns a array of strings showing the sequential encodings used on the |
| 114 // content. | 114 // content. |
| 115 // For example, encoding_types[0] = FILTER_TYPE_SDCH and encoding_types[1] = | 115 // For example, encoding_types[0] = FILTER_TYPE_SDCH and encoding_types[1] = |
| 116 // FILTER_TYPE_GZIP, means the content was first encoded by sdch, and then | 116 // FILTER_TYPE_GZIP, means the content was first encoded by sdch, and then |
| 117 // result was encoded by gzip. To decode, a series of filters must be applied | 117 // result was encoded by gzip. To decode, a series of filters must be applied |
| 118 // in the reverse order (in the above example, ungzip first, and then sdch | 118 // in the reverse order (in the above example, ungzip first, and then sdch |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 void set_expected_content_size(const int64& size) { | 188 void set_expected_content_size(const int64& size) { |
| 189 expected_content_size_ = size; | 189 expected_content_size_ = size; |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Whether we have processed the response for that request yet. | 192 // Whether we have processed the response for that request yet. |
| 193 bool has_response_started() const { return has_handled_response_; } | 193 bool has_response_started() const { return has_handled_response_; } |
| 194 | 194 |
| 195 // FilterContext methods: | 195 // FilterContext methods: |
| 196 // These methods are not applicable to all connections. | 196 // These methods are not applicable to all connections. |
| 197 virtual bool GetMimeType(std::string* mime_type) const { return false; } | 197 virtual bool GetMimeType(std::string* mime_type) const { return false; } |
| 198 virtual int64 GetByteReadCount() const; | |
| 199 virtual bool GetURL(GURL* gurl) const; | 198 virtual bool GetURL(GURL* gurl) const; |
| 200 virtual base::Time GetRequestTime() const; | 199 virtual base::Time GetRequestTime() const; |
| 201 virtual bool IsCachedContent() const; | 200 virtual bool IsCachedContent() const; |
| 201 virtual int64 GetByteReadCount() const; |
| 202 virtual int GetInputStreamBufferSize() const { return kFilterBufSize; } | 202 virtual int GetInputStreamBufferSize() const { return kFilterBufSize; } |
| 203 | 203 |
| 204 protected: | 204 protected: |
| 205 // Notifies the job that headers have been received. | 205 // Notifies the job that headers have been received. |
| 206 void NotifyHeadersComplete(); | 206 void NotifyHeadersComplete(); |
| 207 | 207 |
| 208 // Notifies the request that the job has completed a Read operation. | 208 // Notifies the request that the job has completed a Read operation. |
| 209 void NotifyReadComplete(int bytes_read); | 209 void NotifyReadComplete(int bytes_read); |
| 210 | 210 |
| 211 // Notifies the request that a start error has occurred. | 211 // Notifies the request that a start error has occurred. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 318 |
| 319 // Total number of bytes read from network (or cache) and and typically handed | 319 // Total number of bytes read from network (or cache) and and typically handed |
| 320 // to filter to process. Used to histogram compression ratios, and error | 320 // to filter to process. Used to histogram compression ratios, and error |
| 321 // recovery scenarios in filters. | 321 // recovery scenarios in filters. |
| 322 int64 filter_input_byte_count_; | 322 int64 filter_input_byte_count_; |
| 323 | 323 |
| 324 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 324 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
| 325 }; | 325 }; |
| 326 | 326 |
| 327 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 327 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
| OLD | NEW |