[Presentation API] Plumbing of |onstatechange| from the Mojo service to the public...
[chromium-blink-merge.git] / net / http / http_basic_stream.h
blob194f7ef6c206380a55d1b4ab002222d9b98eb637
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 ~HttpBasicStream() override;
35 // HttpStream methods:
36 int InitializeStream(const HttpRequestInfo* request_info,
37 RequestPriority priority,
38 const BoundNetLog& net_log,
39 const CompletionCallback& callback) override;
41 int SendRequest(const HttpRequestHeaders& headers,
42 HttpResponseInfo* response,
43 const CompletionCallback& callback) override;
45 UploadProgress GetUploadProgress() const override;
47 int ReadResponseHeaders(const CompletionCallback& callback) override;
49 int ReadResponseBody(IOBuffer* buf,
50 int buf_len,
51 const CompletionCallback& callback) override;
53 void Close(bool not_reusable) override;
55 HttpStream* RenewStreamForAuth() override;
57 bool IsResponseBodyComplete() const override;
59 bool CanFindEndOfResponse() const override;
61 bool IsConnectionReused() const override;
63 void SetConnectionReused() override;
65 bool IsConnectionReusable() const override;
67 int64 GetTotalReceivedBytes() const override;
69 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
71 void GetSSLInfo(SSLInfo* ssl_info) override;
73 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override;
75 bool IsSpdyHttpStream() const override;
77 void Drain(HttpNetworkSession* session) override;
79 void SetPriority(RequestPriority priority) override;
81 private:
82 HttpStreamParser* parser() const { return state_.parser(); }
84 HttpBasicState state_;
86 DISALLOW_COPY_AND_ASSIGN(HttpBasicStream);
89 } // namespace net
91 #endif // NET_HTTP_HTTP_BASIC_STREAM_H_