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_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 5 #ifndef NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 virtual ~HttpNetworkTransaction(); | 33 virtual ~HttpNetworkTransaction(); |
34 | 34 |
35 // HttpTransaction methods: | 35 // HttpTransaction methods: |
36 virtual int Start(const HttpRequestInfo* request_info, | 36 virtual int Start(const HttpRequestInfo* request_info, |
37 CompletionCallback* callback); | 37 CompletionCallback* callback); |
38 virtual int RestartIgnoringLastError(CompletionCallback* callback); | 38 virtual int RestartIgnoringLastError(CompletionCallback* callback); |
39 virtual int RestartWithAuth(const std::wstring& username, | 39 virtual int RestartWithAuth(const std::wstring& username, |
40 const std::wstring& password, | 40 const std::wstring& password, |
41 CompletionCallback* callback); | 41 CompletionCallback* callback); |
42 virtual int Read(char* buf, int buf_len, CompletionCallback* callback); | 42 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
43 virtual const HttpResponseInfo* GetResponseInfo() const; | 43 virtual const HttpResponseInfo* GetResponseInfo() const; |
44 virtual LoadState GetLoadState() const; | 44 virtual LoadState GetLoadState() const; |
45 virtual uint64 GetUploadProgress() const; | 45 virtual uint64 GetUploadProgress() const; |
46 | 46 |
47 private: | 47 private: |
48 void BuildRequestHeaders(); | 48 void BuildRequestHeaders(); |
49 void BuildTunnelRequest(); | 49 void BuildTunnelRequest(); |
50 void DoCallback(int result); | 50 void DoCallback(int result); |
51 void OnIOComplete(int result); | 51 void OnIOComplete(int result); |
52 | 52 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // than zero (and chunked_decoder_ is null), then we read until the server | 252 // than zero (and chunked_decoder_ is null), then we read until the server |
253 // closes the connection. | 253 // closes the connection. |
254 int64 content_length_; | 254 int64 content_length_; |
255 | 255 |
256 // Keeps track of the number of response body bytes read so far. | 256 // Keeps track of the number of response body bytes read so far. |
257 int64 content_read_; | 257 int64 content_read_; |
258 | 258 |
259 scoped_ptr<HttpChunkedDecoder> chunked_decoder_; | 259 scoped_ptr<HttpChunkedDecoder> chunked_decoder_; |
260 | 260 |
261 // User buffer and length passed to the Read method. | 261 // User buffer and length passed to the Read method. |
262 char* read_buf_; | 262 scoped_refptr<IOBuffer> read_buf_; |
263 int read_buf_len_; | 263 int read_buf_len_; |
264 | 264 |
265 enum State { | 265 enum State { |
266 STATE_RESOLVE_PROXY, | 266 STATE_RESOLVE_PROXY, |
267 STATE_RESOLVE_PROXY_COMPLETE, | 267 STATE_RESOLVE_PROXY_COMPLETE, |
268 STATE_INIT_CONNECTION, | 268 STATE_INIT_CONNECTION, |
269 STATE_INIT_CONNECTION_COMPLETE, | 269 STATE_INIT_CONNECTION_COMPLETE, |
270 STATE_RESOLVE_HOST, | 270 STATE_RESOLVE_HOST, |
271 STATE_RESOLVE_HOST_COMPLETE, | 271 STATE_RESOLVE_HOST_COMPLETE, |
272 STATE_CONNECT, | 272 STATE_CONNECT, |
(...skipping 10 matching lines...) Expand all Loading... |
283 STATE_READ_BODY_COMPLETE, | 283 STATE_READ_BODY_COMPLETE, |
284 STATE_NONE | 284 STATE_NONE |
285 }; | 285 }; |
286 State next_state_; | 286 State next_state_; |
287 }; | 287 }; |
288 | 288 |
289 } // namespace net | 289 } // namespace net |
290 | 290 |
291 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 291 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
292 | 292 |
OLD | NEW |