OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_STREAM_FACTORY_IMPL_REQUEST_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "net/base/net_log.h" | 11 #include "net/base/net_log.h" |
12 #include "net/http/http_stream_factory_impl.h" | 12 #include "net/http/http_stream_factory_impl.h" |
13 #include "net/socket/ssl_client_socket.h" | 13 #include "net/socket/ssl_client_socket.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
tyoshino (SeeGerritForStatus)
2013/05/13 11:04:44
blank line please
yhirano
2013/05/13 11:45:50
Done.
| |
16 class ClientSocketHandle; | |
17 class SpdySession; | |
16 | 18 |
17 class HttpStreamFactoryImpl::Request : public HttpStreamRequest { | 19 class HttpStreamFactoryImpl::Request : public HttpStreamRequest { |
18 public: | 20 public: |
19 Request(const GURL& url, | 21 Request(const GURL& url, |
20 HttpStreamFactoryImpl* factory, | 22 HttpStreamFactoryImpl* factory, |
21 HttpStreamRequest::Delegate* delegate, | 23 HttpStreamRequest::Delegate* delegate, |
22 const BoundNetLog& net_log); | 24 const BoundNetLog& net_log, |
25 bool for_websocket); | |
23 virtual ~Request(); | 26 virtual ~Request(); |
24 | 27 |
25 // The GURL from the HttpRequestInfo the started the Request. | 28 // The GURL from the HttpRequestInfo the started the Request. |
26 const GURL& url() const { return url_; } | 29 const GURL& url() const { return url_; } |
27 | 30 |
28 // Called when the Job determines the appropriate |spdy_session_key| for the | 31 // Called when the Job determines the appropriate |spdy_session_key| for the |
29 // Request. Note that this does not mean that SPDY is necessarily supported | 32 // Request. Note that this does not mean that SPDY is necessarily supported |
30 // for this HostPortProxyPair, since we may need to wait for NPN to complete | 33 // for this HostPortProxyPair, since we may need to wait for NPN to complete |
31 // before knowing if SPDY is available. | 34 // before knowing if SPDY is available. |
32 void SetSpdySessionKey(const HostPortProxyPair& spdy_session_key); | 35 void SetSpdySessionKey(const HostPortProxyPair& spdy_session_key); |
(...skipping 28 matching lines...) Expand all Loading... | |
61 scoped_refptr<SpdySession> spdy_session, | 64 scoped_refptr<SpdySession> spdy_session, |
62 bool direct); | 65 bool direct); |
63 | 66 |
64 // HttpStreamRequest::Delegate methods which we implement. Note we don't | 67 // HttpStreamRequest::Delegate methods which we implement. Note we don't |
65 // actually subclass HttpStreamRequest::Delegate. | 68 // actually subclass HttpStreamRequest::Delegate. |
66 | 69 |
67 void OnStreamReady(Job* job, | 70 void OnStreamReady(Job* job, |
68 const SSLConfig& used_ssl_config, | 71 const SSLConfig& used_ssl_config, |
69 const ProxyInfo& used_proxy_info, | 72 const ProxyInfo& used_proxy_info, |
70 HttpStreamBase* stream); | 73 HttpStreamBase* stream); |
74 // Called by an attached Job if it wants to pass a spdy session | |
75 // to the delegate. | |
76 void OnSpdySessionReadyForWS(Job* job, | |
77 const SSLConfig& used_ssl_config, | |
78 const ProxyInfo& used_proxy_info, | |
79 scoped_refptr<SpdySession> session); | |
80 void OnSocketReady(Job* job, | |
81 const SSLConfig& used_ssl_config, | |
82 const ProxyInfo& used_proxy_info, | |
83 ClientSocketHandle* connection); | |
71 void OnStreamFailed(Job* job, int status, const SSLConfig& used_ssl_config); | 84 void OnStreamFailed(Job* job, int status, const SSLConfig& used_ssl_config); |
72 void OnCertificateError(Job* job, | 85 void OnCertificateError(Job* job, |
73 int status, | 86 int status, |
74 const SSLConfig& used_ssl_config, | 87 const SSLConfig& used_ssl_config, |
75 const SSLInfo& ssl_info); | 88 const SSLInfo& ssl_info); |
76 void OnNeedsProxyAuth(Job* job, | 89 void OnNeedsProxyAuth(Job* job, |
77 const HttpResponseInfo& proxy_response, | 90 const HttpResponseInfo& proxy_response, |
78 const SSLConfig& used_ssl_config, | 91 const SSLConfig& used_ssl_config, |
79 const ProxyInfo& used_proxy_info, | 92 const ProxyInfo& used_proxy_info, |
80 HttpAuthController* auth_controller); | 93 HttpAuthController* auth_controller); |
81 void OnNeedsClientAuth(Job* job, | 94 void OnNeedsClientAuth(Job* job, |
82 const SSLConfig& used_ssl_config, | 95 const SSLConfig& used_ssl_config, |
83 SSLCertRequestInfo* cert_info); | 96 SSLCertRequestInfo* cert_info); |
84 void OnHttpsProxyTunnelResponse( | 97 void OnHttpsProxyTunnelResponse( |
85 Job *job, | 98 Job *job, |
86 const HttpResponseInfo& response_info, | 99 const HttpResponseInfo& response_info, |
87 const SSLConfig& used_ssl_config, | 100 const SSLConfig& used_ssl_config, |
88 const ProxyInfo& used_proxy_info, | 101 const ProxyInfo& used_proxy_info, |
89 HttpStreamBase* stream); | 102 HttpStreamBase* stream); |
90 | 103 |
104 bool for_websocket() const { return for_websocket_; } | |
105 | |
91 // HttpStreamRequest methods. | 106 // HttpStreamRequest methods. |
92 | 107 |
93 virtual int RestartTunnelWithProxyAuth( | 108 virtual int RestartTunnelWithProxyAuth( |
94 const AuthCredentials& credentials) OVERRIDE; | 109 const AuthCredentials& credentials) OVERRIDE; |
95 virtual LoadState GetLoadState() const OVERRIDE; | 110 virtual LoadState GetLoadState() const OVERRIDE; |
96 virtual bool was_npn_negotiated() const OVERRIDE; | 111 virtual bool was_npn_negotiated() const OVERRIDE; |
97 virtual NextProto protocol_negotiated() const OVERRIDE; | 112 virtual NextProto protocol_negotiated() const OVERRIDE; |
98 virtual bool using_spdy() const OVERRIDE; | 113 virtual bool using_spdy() const OVERRIDE; |
99 | 114 |
100 private: | 115 private: |
(...skipping 13 matching lines...) Expand all Loading... | |
114 scoped_ptr<Job> bound_job_; | 129 scoped_ptr<Job> bound_job_; |
115 std::set<HttpStreamFactoryImpl::Job*> jobs_; | 130 std::set<HttpStreamFactoryImpl::Job*> jobs_; |
116 scoped_ptr<const HostPortProxyPair> spdy_session_key_; | 131 scoped_ptr<const HostPortProxyPair> spdy_session_key_; |
117 scoped_ptr<const HttpPipelinedHost::Key> http_pipelining_key_; | 132 scoped_ptr<const HttpPipelinedHost::Key> http_pipelining_key_; |
118 | 133 |
119 bool completed_; | 134 bool completed_; |
120 bool was_npn_negotiated_; | 135 bool was_npn_negotiated_; |
121 // Protocol negotiated with the server. | 136 // Protocol negotiated with the server. |
122 NextProto protocol_negotiated_; | 137 NextProto protocol_negotiated_; |
123 bool using_spdy_; | 138 bool using_spdy_; |
139 bool for_websocket_; | |
124 | 140 |
125 DISALLOW_COPY_AND_ASSIGN(Request); | 141 DISALLOW_COPY_AND_ASSIGN(Request); |
126 }; | 142 }; |
127 | 143 |
128 } // namespace net | 144 } // namespace net |
129 | 145 |
130 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ | 146 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
OLD | NEW |