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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
16 #include "net/base/load_states.h" | 16 #include "net/base/load_states.h" |
17 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
18 #include "net/base/request_priority.h" | 18 #include "net/base/request_priority.h" |
19 #include "net/http/http_server_properties.h" | 19 #include "net/http/http_server_properties.h" |
20 #include "net/socket/ssl_client_socket.h" | 20 #include "net/socket/ssl_client_socket.h" |
| 21 // This file can be included from net/http even though |
| 22 // it is in net/websockets because it doesn't |
| 23 // introduce any link dependency to net/websockets. |
| 24 #include "net/websockets/websocket_stream_base.h" |
21 | 25 |
22 class GURL; | 26 class GURL; |
23 | 27 |
24 namespace base { | 28 namespace base { |
25 class Value; | 29 class Value; |
26 } | 30 } |
27 | 31 |
28 namespace net { | 32 namespace net { |
29 | 33 |
30 class AuthCredentials; | 34 class AuthCredentials; |
(...skipping 17 matching lines...) Expand all Loading... |
48 // which no callbacks will be invoked. | 52 // which no callbacks will be invoked. |
49 class NET_EXPORT_PRIVATE HttpStreamRequest { | 53 class NET_EXPORT_PRIVATE HttpStreamRequest { |
50 public: | 54 public: |
51 // The HttpStreamRequest::Delegate is a set of callback methods for a | 55 // The HttpStreamRequest::Delegate is a set of callback methods for a |
52 // HttpStreamRequestJob. Generally, only one of these methods will be | 56 // HttpStreamRequestJob. Generally, only one of these methods will be |
53 // called as a result of a stream request. | 57 // called as a result of a stream request. |
54 class NET_EXPORT_PRIVATE Delegate { | 58 class NET_EXPORT_PRIVATE Delegate { |
55 public: | 59 public: |
56 virtual ~Delegate() {} | 60 virtual ~Delegate() {} |
57 | 61 |
58 // This is the success case. | 62 // This is the success case for RequestStream. |
59 // |stream| is now owned by the delegate. | 63 // |stream| is now owned by the delegate. |
60 // |used_ssl_config| indicates the actual SSL configuration used for this | 64 // |used_ssl_config| indicates the actual SSL configuration used for this |
61 // stream, since the HttpStreamRequest may have modified the configuration | 65 // stream, since the HttpStreamRequest may have modified the configuration |
62 // during stream processing. | 66 // during stream processing. |
63 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, | 67 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, |
64 // since the HttpStreamRequest performs the proxy resolution. | 68 // since the HttpStreamRequest performs the proxy resolution. |
65 virtual void OnStreamReady( | 69 virtual void OnStreamReady( |
66 const SSLConfig& used_ssl_config, | 70 const SSLConfig& used_ssl_config, |
67 const ProxyInfo& used_proxy_info, | 71 const ProxyInfo& used_proxy_info, |
68 HttpStreamBase* stream) = 0; | 72 HttpStreamBase* stream) = 0; |
69 | 73 |
| 74 // This is the success case for RequestWebSocketStream. |
| 75 // |stream| is now owned by the delegate. |
| 76 // |used_ssl_config| indicates the actual SSL configuration used for this |
| 77 // stream, since the HttpStreamRequest may have modified the configuration |
| 78 // during stream processing. |
| 79 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, |
| 80 // since the HttpStreamRequest performs the proxy resolution. |
| 81 virtual void OnWebSocketStreamReady( |
| 82 const SSLConfig& used_ssl_config, |
| 83 const ProxyInfo& used_proxy_info, |
| 84 WebSocketStreamBase* stream) = 0; |
| 85 |
70 // This is the failure to create a stream case. | 86 // This is the failure to create a stream case. |
71 // |used_ssl_config| indicates the actual SSL configuration used for this | 87 // |used_ssl_config| indicates the actual SSL configuration used for this |
72 // stream, since the HttpStreamRequest may have modified the configuration | 88 // stream, since the HttpStreamRequest may have modified the configuration |
73 // during stream processing. | 89 // during stream processing. |
74 virtual void OnStreamFailed(int status, | 90 virtual void OnStreamFailed(int status, |
75 const SSLConfig& used_ssl_config) = 0; | 91 const SSLConfig& used_ssl_config) = 0; |
76 | 92 |
77 // Called when we have a certificate error for the request. | 93 // Called when we have a certificate error for the request. |
78 // |used_ssl_config| indicates the actual SSL configuration used for this | 94 // |used_ssl_config| indicates the actual SSL configuration used for this |
79 // stream, since the HttpStreamRequest may have modified the configuration | 95 // 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( | 178 void ProcessAlternateProtocol( |
163 HttpServerProperties* http_server_properties, | 179 HttpServerProperties* http_server_properties, |
164 const std::string& alternate_protocol_str, | 180 const std::string& alternate_protocol_str, |
165 const HostPortPair& http_host_port_pair); | 181 const HostPortPair& http_host_port_pair); |
166 | 182 |
167 GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint); | 183 GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint); |
168 | 184 |
169 // Virtual interface methods. | 185 // Virtual interface methods. |
170 | 186 |
171 // Request a stream. | 187 // Request a stream. |
172 // Will callback to the HttpStreamRequestDelegate upon completion. | 188 // Will call delegate->OnStreamReady on successful completion. |
173 virtual HttpStreamRequest* RequestStream( | 189 virtual HttpStreamRequest* RequestStream( |
174 const HttpRequestInfo& info, | 190 const HttpRequestInfo& info, |
175 RequestPriority priority, | 191 RequestPriority priority, |
176 const SSLConfig& server_ssl_config, | 192 const SSLConfig& server_ssl_config, |
177 const SSLConfig& proxy_ssl_config, | 193 const SSLConfig& proxy_ssl_config, |
178 HttpStreamRequest::Delegate* delegate, | 194 HttpStreamRequest::Delegate* delegate, |
179 const BoundNetLog& net_log) = 0; | 195 const BoundNetLog& net_log) = 0; |
180 | 196 |
| 197 // Request a WebSocket stream. |
| 198 // Will call delegate->OnWebSocketStreamReady on successful completion. |
| 199 virtual HttpStreamRequest* RequestWebSocketStream( |
| 200 const HttpRequestInfo& info, |
| 201 RequestPriority priority, |
| 202 const SSLConfig& server_ssl_config, |
| 203 const SSLConfig& proxy_ssl_config, |
| 204 HttpStreamRequest::Delegate* delegate, |
| 205 WebSocketStreamBase::Factory* factory, |
| 206 const BoundNetLog& net_log) = 0; |
| 207 |
181 // Requests that enough connections for |num_streams| be opened. | 208 // Requests that enough connections for |num_streams| be opened. |
182 virtual void PreconnectStreams(int num_streams, | 209 virtual void PreconnectStreams(int num_streams, |
183 const HttpRequestInfo& info, | 210 const HttpRequestInfo& info, |
184 RequestPriority priority, | 211 RequestPriority priority, |
185 const SSLConfig& server_ssl_config, | 212 const SSLConfig& server_ssl_config, |
186 const SSLConfig& proxy_ssl_config) = 0; | 213 const SSLConfig& proxy_ssl_config) = 0; |
187 | 214 |
188 // If pipelining is supported, creates a Value summary of the currently active | 215 // If pipelining is supported, creates a Value summary of the currently active |
189 // pipelines. Caller assumes ownership of the returned value. Otherwise, | 216 // pipelines. Caller assumes ownership of the returned value. Otherwise, |
190 // returns an empty Value. | 217 // returns an empty Value. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 static bool force_spdy_over_ssl_; | 292 static bool force_spdy_over_ssl_; |
266 static bool force_spdy_always_; | 293 static bool force_spdy_always_; |
267 static std::list<HostPortPair>* forced_spdy_exclusions_; | 294 static std::list<HostPortPair>* forced_spdy_exclusions_; |
268 | 295 |
269 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory); | 296 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory); |
270 }; | 297 }; |
271 | 298 |
272 } // namespace net | 299 } // namespace net |
273 | 300 |
274 #endif // NET_HTTP_HTTP_STREAM_FACTORY_H_ | 301 #endif // NET_HTTP_HTTP_STREAM_FACTORY_H_ |
OLD | NEW |