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