Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: net/http/http_stream_factory_impl_request.h

Issue 14813024: Introduce RequestWebSocketStream into HttpStreamFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a comment. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 {
16 16
17 class ClientSocketHandle;
18 class SpdySession;
19
17 class HttpStreamFactoryImpl::Request : public HttpStreamRequest { 20 class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
18 public: 21 public:
19 Request(const GURL& url, 22 Request(const GURL& url,
20 HttpStreamFactoryImpl* factory, 23 HttpStreamFactoryImpl* factory,
21 HttpStreamRequest::Delegate* delegate, 24 HttpStreamRequest::Delegate* delegate,
22 const BoundNetLog& net_log); 25 const BoundNetLog& net_log,
26 bool for_websocket);
23 virtual ~Request(); 27 virtual ~Request();
24 28
25 // The GURL from the HttpRequestInfo the started the Request. 29 // The GURL from the HttpRequestInfo the started the Request.
26 const GURL& url() const { return url_; } 30 const GURL& url() const { return url_; }
27 31
28 // Called when the Job determines the appropriate |spdy_session_key| for the 32 // 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 33 // 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 34 // for this HostPortProxyPair, since we may need to wait for NPN to complete
31 // before knowing if SPDY is available. 35 // before knowing if SPDY is available.
32 void SetSpdySessionKey(const HostPortProxyPair& spdy_session_key); 36 void SetSpdySessionKey(const HostPortProxyPair& spdy_session_key);
(...skipping 28 matching lines...) Expand all
61 scoped_refptr<SpdySession> spdy_session, 65 scoped_refptr<SpdySession> spdy_session,
62 bool direct); 66 bool direct);
63 67
64 // HttpStreamRequest::Delegate methods which we implement. Note we don't 68 // HttpStreamRequest::Delegate methods which we implement. Note we don't
65 // actually subclass HttpStreamRequest::Delegate. 69 // actually subclass HttpStreamRequest::Delegate.
66 70
67 void OnStreamReady(Job* job, 71 void OnStreamReady(Job* job,
68 const SSLConfig& used_ssl_config, 72 const SSLConfig& used_ssl_config,
69 const ProxyInfo& used_proxy_info, 73 const ProxyInfo& used_proxy_info,
70 HttpStreamBase* stream); 74 HttpStreamBase* stream);
75 // Called by an attached Job if it wants to pass a spdy session
76 // to the delegate.
77 void OnSpdySessionReadyForWS(Job* job,
78 const SSLConfig& used_ssl_config,
79 const ProxyInfo& used_proxy_info,
80 scoped_refptr<SpdySession> session);
81 void OnSocketReady(Job* job,
82 const SSLConfig& used_ssl_config,
83 const ProxyInfo& used_proxy_info,
84 ClientSocketHandle* connection);
71 void OnStreamFailed(Job* job, int status, const SSLConfig& used_ssl_config); 85 void OnStreamFailed(Job* job, int status, const SSLConfig& used_ssl_config);
72 void OnCertificateError(Job* job, 86 void OnCertificateError(Job* job,
73 int status, 87 int status,
74 const SSLConfig& used_ssl_config, 88 const SSLConfig& used_ssl_config,
75 const SSLInfo& ssl_info); 89 const SSLInfo& ssl_info);
76 void OnNeedsProxyAuth(Job* job, 90 void OnNeedsProxyAuth(Job* job,
77 const HttpResponseInfo& proxy_response, 91 const HttpResponseInfo& proxy_response,
78 const SSLConfig& used_ssl_config, 92 const SSLConfig& used_ssl_config,
79 const ProxyInfo& used_proxy_info, 93 const ProxyInfo& used_proxy_info,
80 HttpAuthController* auth_controller); 94 HttpAuthController* auth_controller);
81 void OnNeedsClientAuth(Job* job, 95 void OnNeedsClientAuth(Job* job,
82 const SSLConfig& used_ssl_config, 96 const SSLConfig& used_ssl_config,
83 SSLCertRequestInfo* cert_info); 97 SSLCertRequestInfo* cert_info);
84 void OnHttpsProxyTunnelResponse( 98 void OnHttpsProxyTunnelResponse(
85 Job *job, 99 Job *job,
86 const HttpResponseInfo& response_info, 100 const HttpResponseInfo& response_info,
87 const SSLConfig& used_ssl_config, 101 const SSLConfig& used_ssl_config,
88 const ProxyInfo& used_proxy_info, 102 const ProxyInfo& used_proxy_info,
89 HttpStreamBase* stream); 103 HttpStreamBase* stream);
90 104
105 bool for_websocket() const { return for_websocket_; }
106
91 // HttpStreamRequest methods. 107 // HttpStreamRequest methods.
92 108
93 virtual int RestartTunnelWithProxyAuth( 109 virtual int RestartTunnelWithProxyAuth(
94 const AuthCredentials& credentials) OVERRIDE; 110 const AuthCredentials& credentials) OVERRIDE;
95 virtual LoadState GetLoadState() const OVERRIDE; 111 virtual LoadState GetLoadState() const OVERRIDE;
96 virtual bool was_npn_negotiated() const OVERRIDE; 112 virtual bool was_npn_negotiated() const OVERRIDE;
97 virtual NextProto protocol_negotiated() const OVERRIDE; 113 virtual NextProto protocol_negotiated() const OVERRIDE;
98 virtual bool using_spdy() const OVERRIDE; 114 virtual bool using_spdy() const OVERRIDE;
99 115
100 private: 116 private:
(...skipping 13 matching lines...) Expand all
114 scoped_ptr<Job> bound_job_; 130 scoped_ptr<Job> bound_job_;
115 std::set<HttpStreamFactoryImpl::Job*> jobs_; 131 std::set<HttpStreamFactoryImpl::Job*> jobs_;
116 scoped_ptr<const HostPortProxyPair> spdy_session_key_; 132 scoped_ptr<const HostPortProxyPair> spdy_session_key_;
117 scoped_ptr<const HttpPipelinedHost::Key> http_pipelining_key_; 133 scoped_ptr<const HttpPipelinedHost::Key> http_pipelining_key_;
118 134
119 bool completed_; 135 bool completed_;
120 bool was_npn_negotiated_; 136 bool was_npn_negotiated_;
121 // Protocol negotiated with the server. 137 // Protocol negotiated with the server.
122 NextProto protocol_negotiated_; 138 NextProto protocol_negotiated_;
123 bool using_spdy_; 139 bool using_spdy_;
140 bool for_websocket_;
124 141
125 DISALLOW_COPY_AND_ASSIGN(Request); 142 DISALLOW_COPY_AND_ASSIGN(Request);
126 }; 143 };
127 144
128 } // namespace net 145 } // namespace net
129 146
130 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ 147 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698