Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / net / http / proxy_connect_redirect_http_stream.h
1 // Copyright 2013 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 #ifndef NET_HTTP_PROXY_CONNECT_REDIRECT_HTTP_STREAM_H_
6 #define NET_HTTP_PROXY_CONNECT_REDIRECT_HTTP_STREAM_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "net/base/load_timing_info.h"
11 #include "net/http/http_stream.h"
12
13 namespace net {
14
15 // A dummy HttpStream with no body used when a redirect is returned
16 // from a proxy.
17 class ProxyConnectRedirectHttpStream : public HttpStream {
18  public:
19   // |load_timing_info| is the info that should be returned by
20   // GetLoadTimingInfo(), or NULL if there is none. Does not take
21   // ownership of |load_timing_info|.
22   explicit ProxyConnectRedirectHttpStream(LoadTimingInfo* load_timing_info);
23   ~ProxyConnectRedirectHttpStream() override;
24
25   // All functions below are expected not to be called except for the
26   // marked one.
27
28   int InitializeStream(const HttpRequestInfo* request_info,
29                        RequestPriority priority,
30                        const BoundNetLog& net_log,
31                        const CompletionCallback& callback) override;
32   int SendRequest(const HttpRequestHeaders& request_headers,
33                   HttpResponseInfo* response,
34                   const CompletionCallback& callback) override;
35   int ReadResponseHeaders(const CompletionCallback& callback) override;
36   int ReadResponseBody(IOBuffer* buf,
37                        int buf_len,
38                        const CompletionCallback& callback) override;
39
40   // This function may be called.
41   void Close(bool not_reusable) override;
42
43   bool IsResponseBodyComplete() const override;
44
45   // This function may be called.
46   bool CanFindEndOfResponse() const override;
47
48   bool IsConnectionReused() const override;
49   void SetConnectionReused() override;
50   bool IsConnectionReusable() const override;
51
52   int64 GetTotalReceivedBytes() const override;
53
54   // This function may be called.
55   bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
56
57   void GetSSLInfo(SSLInfo* ssl_info) override;
58   void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override;
59   bool IsSpdyHttpStream() const override;
60   void Drain(HttpNetworkSession* session) override;
61
62   // This function may be called.
63   void SetPriority(RequestPriority priority) override;
64
65   UploadProgress GetUploadProgress() const override;
66   HttpStream* RenewStreamForAuth() override;
67
68  private:
69   bool has_load_timing_info_;
70   LoadTimingInfo load_timing_info_;
71 };
72
73 }  // namespace net
74
75 #endif  // NET_HTTP_PROXY_CONNECT_REDIRECT_HTTP_STREAM_H_