Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / net / http / http_basic_stream.h
blob55b0efd4a633c8ba877eeba09bd32cd0cd20b821
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 <stdint.h>
14 #include <string>
16 #include "base/basictypes.h"
17 #include "net/http/http_basic_state.h"
18 #include "net/http/http_stream.h"
20 namespace net {
22 class BoundNetLog;
23 class ClientSocketHandle;
24 class HttpResponseInfo;
25 struct HttpRequestInfo;
26 class HttpRequestHeaders;
27 class HttpStreamParser;
28 class IOBuffer;
30 class HttpBasicStream : public HttpStream {
31 public:
32 // Constructs a new HttpBasicStream. InitializeStream must be called to
33 // initialize it correctly.
34 HttpBasicStream(ClientSocketHandle* connection, bool using_proxy);
35 ~HttpBasicStream() override;
37 // HttpStream methods:
38 int InitializeStream(const HttpRequestInfo* request_info,
39 RequestPriority priority,
40 const BoundNetLog& net_log,
41 const CompletionCallback& callback) override;
43 int SendRequest(const HttpRequestHeaders& headers,
44 HttpResponseInfo* response,
45 const CompletionCallback& callback) override;
47 UploadProgress GetUploadProgress() const override;
49 int ReadResponseHeaders(const CompletionCallback& callback) override;
51 int ReadResponseBody(IOBuffer* buf,
52 int buf_len,
53 const CompletionCallback& callback) override;
55 void Close(bool not_reusable) override;
57 HttpStream* RenewStreamForAuth() override;
59 bool IsResponseBodyComplete() const override;
61 bool IsConnectionReused() const override;
63 void SetConnectionReused() override;
65 bool CanReuseConnection() const override;
67 int64 GetTotalReceivedBytes() const override;
69 int64_t GetTotalSentBytes() const override;
71 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
73 void GetSSLInfo(SSLInfo* ssl_info) override;
75 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) 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_