Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / net / http / http_basic_stream.h
blob00253c37db4e4a8129f36c1827212ecb140ddbcc
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
3 // found in the LICENSE file.
4 //
5 // HttpBasicStream is a simple implementation of HttpStream. It assumes it is
6 // not sharing a sharing with any other HttpStreams, therefore it just reads and
7 // writes directly to the Http Stream.
9 #ifndef NET_HTTP_HTTP_BASIC_STREAM_H_
10 #define NET_HTTP_HTTP_BASIC_STREAM_H_
12 #include <string>
14 #include "base/basictypes.h"
15 #include "net/http/http_basic_state.h"
16 #include "net/http/http_stream.h"
18 namespace net {
20 class BoundNetLog;
21 class ClientSocketHandle;
22 class HttpResponseInfo;
23 struct HttpRequestInfo;
24 class HttpRequestHeaders;
25 class HttpStreamParser;
26 class IOBuffer;
28 class HttpBasicStream : public HttpStream {
29 public:
30 // Constructs a new HttpBasicStream. InitializeStream must be called to
31 // initialize it correctly.
32 HttpBasicStream(ClientSocketHandle* connection, bool using_proxy);
33 virtual ~HttpBasicStream();
35 // HttpStream methods:
36 virtual int InitializeStream(const HttpRequestInfo* request_info,
37 RequestPriority priority,
38 const BoundNetLog& net_log,
39 const CompletionCallback& callback) OVERRIDE;
41 virtual int SendRequest(const HttpRequestHeaders& headers,
42 HttpResponseInfo* response,
43 const CompletionCallback& callback) OVERRIDE;
45 virtual UploadProgress GetUploadProgress() const OVERRIDE;
47 virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE;
49 virtual int ReadResponseBody(IOBuffer* buf,
50 int buf_len,
51 const CompletionCallback& callback) OVERRIDE;
53 virtual void Close(bool not_reusable) OVERRIDE;
55 virtual HttpStream* RenewStreamForAuth() OVERRIDE;
57 virtual bool IsResponseBodyComplete() const OVERRIDE;
59 virtual bool CanFindEndOfResponse() const OVERRIDE;
61 virtual bool IsConnectionReused() const OVERRIDE;
63 virtual void SetConnectionReused() OVERRIDE;
65 virtual bool IsConnectionReusable() const OVERRIDE;
67 virtual int64 GetTotalReceivedBytes() const OVERRIDE;
69 virtual bool GetLoadTimingInfo(
70 LoadTimingInfo* load_timing_info) const OVERRIDE;
72 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE;
74 virtual void GetSSLCertRequestInfo(
75 SSLCertRequestInfo* cert_request_info) OVERRIDE;
77 virtual bool IsSpdyHttpStream() const OVERRIDE;
79 virtual void Drain(HttpNetworkSession* session) OVERRIDE;
81 virtual void SetPriority(RequestPriority priority) OVERRIDE;
83 private:
84 HttpStreamParser* parser() const { return state_.parser(); }
86 HttpBasicState state_;
88 DISALLOW_COPY_AND_ASSIGN(HttpBasicStream);
91 } // namespace net
93 #endif // NET_HTTP_HTTP_BASIC_STREAM_H_