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_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_H_ |
6 #define NET_HTTP_HTTP_STREAM_FACTORY_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 11 matching lines...) Expand all Loading... |
22 class GURL; | 22 class GURL; |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class Value; | 25 class Value; |
26 } | 26 } |
27 | 27 |
28 namespace net { | 28 namespace net { |
29 | 29 |
30 class AuthCredentials; | 30 class AuthCredentials; |
31 class BoundNetLog; | 31 class BoundNetLog; |
| 32 class ClientSocketHandle; |
32 class HostMappingRules; | 33 class HostMappingRules; |
33 class HostPortPair; | 34 class HostPortPair; |
34 class HttpAuthController; | 35 class HttpAuthController; |
35 class HttpResponseInfo; | 36 class HttpResponseInfo; |
36 class HttpServerProperties; | 37 class HttpServerProperties; |
37 class HttpStreamBase; | 38 class HttpStreamBase; |
38 class ProxyInfo; | 39 class ProxyInfo; |
39 class SSLCertRequestInfo; | 40 class SSLCertRequestInfo; |
40 class SSLInfo; | 41 class SSLInfo; |
| 42 class SpdySession; |
41 struct HttpRequestInfo; | 43 struct HttpRequestInfo; |
42 struct SSLConfig; | 44 struct SSLConfig; |
43 | 45 |
44 // The HttpStreamRequest is the client's handle to the worker object which | 46 // The HttpStreamRequest is the client's handle to the worker object which |
45 // handles the creation of an HttpStream. While the HttpStream is being | 47 // handles the creation of an HttpStream. While the HttpStream is being |
46 // created, this object is the creator's handle for interacting with the | 48 // created, this object is the creator's handle for interacting with the |
47 // HttpStream creation process. The request is cancelled by deleting it, after | 49 // HttpStream creation process. The request is cancelled by deleting it, after |
48 // which no callbacks will be invoked. | 50 // which no callbacks will be invoked. |
49 class NET_EXPORT_PRIVATE HttpStreamRequest { | 51 class NET_EXPORT_PRIVATE HttpStreamRequest { |
50 public: | 52 public: |
51 // The HttpStreamRequest::Delegate is a set of callback methods for a | 53 // The HttpStreamRequest::Delegate is a set of callback methods for a |
52 // HttpStreamRequestJob. Generally, only one of these methods will be | 54 // HttpStreamRequestJob. Generally, only one of these methods will be |
53 // called as a result of a stream request. | 55 // called as a result of a stream request. |
54 class NET_EXPORT_PRIVATE Delegate { | 56 class NET_EXPORT_PRIVATE Delegate { |
55 public: | 57 public: |
56 virtual ~Delegate() {} | 58 virtual ~Delegate() {} |
57 | 59 |
58 // This is the success case. | 60 // This is the success case for RequestStream. |
59 // |stream| is now owned by the delegate. | 61 // |stream| is now owned by the delegate. |
60 // |used_ssl_config| indicates the actual SSL configuration used for this | 62 // |used_ssl_config| indicates the actual SSL configuration used for this |
61 // stream, since the HttpStreamRequest may have modified the configuration | 63 // stream, since the HttpStreamRequest may have modified the configuration |
62 // during stream processing. | 64 // during stream processing. |
63 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, | 65 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, |
64 // since the HttpStreamRequest performs the proxy resolution. | 66 // since the HttpStreamRequest performs the proxy resolution. |
65 virtual void OnStreamReady( | 67 virtual void OnStreamReady( |
66 const SSLConfig& used_ssl_config, | 68 const SSLConfig& used_ssl_config, |
67 const ProxyInfo& used_proxy_info, | 69 const ProxyInfo& used_proxy_info, |
68 HttpStreamBase* stream) = 0; | 70 HttpStreamBase* stream) = 0; |
69 | 71 |
| 72 // This is a success case for RequestStreamForWebSocket. |
| 73 // |connection| is now owned by the delegate. |
| 74 // |used_ssl_config| indicates the actual SSL configuration used for this |
| 75 // stream, since the HttpStreamRequest may have modified the configuration |
| 76 // during stream processing. |
| 77 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, |
| 78 // since the HttpStreamRequest performs the proxy resolution. |
| 79 virtual void OnSocketReady( |
| 80 const SSLConfig& used_ssl_config, |
| 81 const ProxyInfo& used_proxy_info, |
| 82 ClientSocketHandle* connection) = 0; |
| 83 |
| 84 // This is a success case for RequestStreamForWebSocket. |
| 85 // |session| is referenced by the caller. |
| 86 // You should create and hold a scoped_refptr to retain it. |
| 87 // |used_ssl_config| indicates the actual SSL configuration used for this |
| 88 // stream, since the HttpStreamRequest may have modified the configuration |
| 89 // during stream processing. |
| 90 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, |
| 91 // since the HttpStreamRequest performs the proxy resolution. |
| 92 virtual void OnSpdySessionReady( |
| 93 const SSLConfig& used_ssl_config, |
| 94 const ProxyInfo& used_proxy_info, |
| 95 SpdySession* session) = 0; |
| 96 |
70 // This is the failure to create a stream case. | 97 // This is the failure to create a stream case. |
71 // |used_ssl_config| indicates the actual SSL configuration used for this | 98 // |used_ssl_config| indicates the actual SSL configuration used for this |
72 // stream, since the HttpStreamRequest may have modified the configuration | 99 // stream, since the HttpStreamRequest may have modified the configuration |
73 // during stream processing. | 100 // during stream processing. |
74 virtual void OnStreamFailed(int status, | 101 virtual void OnStreamFailed(int status, |
75 const SSLConfig& used_ssl_config) = 0; | 102 const SSLConfig& used_ssl_config) = 0; |
76 | 103 |
77 // Called when we have a certificate error for the request. | 104 // Called when we have a certificate error for the request. |
78 // |used_ssl_config| indicates the actual SSL configuration used for this | 105 // |used_ssl_config| indicates the actual SSL configuration used for this |
79 // stream, since the HttpStreamRequest may have modified the configuration | 106 // stream, since the HttpStreamRequest may have modified the configuration |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 void ProcessAlternateProtocol( | 189 void ProcessAlternateProtocol( |
163 HttpServerProperties* http_server_properties, | 190 HttpServerProperties* http_server_properties, |
164 const std::string& alternate_protocol_str, | 191 const std::string& alternate_protocol_str, |
165 const HostPortPair& http_host_port_pair); | 192 const HostPortPair& http_host_port_pair); |
166 | 193 |
167 GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint); | 194 GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint); |
168 | 195 |
169 // Virtual interface methods. | 196 // Virtual interface methods. |
170 | 197 |
171 // Request a stream. | 198 // Request a stream. |
172 // Will callback to the HttpStreamRequestDelegate upon completion. | 199 // Will call delegate->OnStreamReady upon completion. |
173 virtual HttpStreamRequest* RequestStream( | 200 virtual HttpStreamRequest* RequestStream( |
174 const HttpRequestInfo& info, | 201 const HttpRequestInfo& info, |
175 RequestPriority priority, | 202 RequestPriority priority, |
176 const SSLConfig& server_ssl_config, | 203 const SSLConfig& server_ssl_config, |
177 const SSLConfig& proxy_ssl_config, | 204 const SSLConfig& proxy_ssl_config, |
178 HttpStreamRequest::Delegate* delegate, | 205 HttpStreamRequest::Delegate* delegate, |
179 const BoundNetLog& net_log) = 0; | 206 const BoundNetLog& net_log) = 0; |
180 | 207 |
| 208 // Request a stream for a websocket connection. |
| 209 // Will call delegate->OnSocketReady or delegate->OnSpdySessionReady |
| 210 // upon completion. |
| 211 virtual HttpStreamRequest* RequestStreamForWebSocket( |
| 212 const HttpRequestInfo& info, |
| 213 RequestPriority priority, |
| 214 const SSLConfig& server_ssl_config, |
| 215 const SSLConfig& proxy_ssl_config, |
| 216 HttpStreamRequest::Delegate* delegate, |
| 217 const BoundNetLog& net_log) = 0; |
| 218 |
181 // Requests that enough connections for |num_streams| be opened. | 219 // Requests that enough connections for |num_streams| be opened. |
182 virtual void PreconnectStreams(int num_streams, | 220 virtual void PreconnectStreams(int num_streams, |
183 const HttpRequestInfo& info, | 221 const HttpRequestInfo& info, |
184 RequestPriority priority, | 222 RequestPriority priority, |
185 const SSLConfig& server_ssl_config, | 223 const SSLConfig& server_ssl_config, |
186 const SSLConfig& proxy_ssl_config) = 0; | 224 const SSLConfig& proxy_ssl_config) = 0; |
187 | 225 |
188 // If pipelining is supported, creates a Value summary of the currently active | 226 // If pipelining is supported, creates a Value summary of the currently active |
189 // pipelines. Caller assumes ownership of the returned value. Otherwise, | 227 // pipelines. Caller assumes ownership of the returned value. Otherwise, |
190 // returns an empty Value. | 228 // returns an empty Value. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 static bool force_spdy_over_ssl_; | 307 static bool force_spdy_over_ssl_; |
270 static bool force_spdy_always_; | 308 static bool force_spdy_always_; |
271 static std::list<HostPortPair>* forced_spdy_exclusions_; | 309 static std::list<HostPortPair>* forced_spdy_exclusions_; |
272 | 310 |
273 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory); | 311 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory); |
274 }; | 312 }; |
275 | 313 |
276 } // namespace net | 314 } // namespace net |
277 | 315 |
278 #endif // NET_HTTP_HTTP_STREAM_FACTORY_H_ | 316 #endif // NET_HTTP_HTTP_STREAM_FACTORY_H_ |
OLD | NEW |