| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_NETWORK_LAYER_H_ | 5 #ifndef NET_HTTP_HTTP_NETWORK_LAYER_H_ |
| 6 #define NET_HTTP_HTTP_NETWORK_LAYER_H_ | 6 #define NET_HTTP_HTTP_NETWORK_LAYER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/non_thread_safe.h" | 11 #include "base/non_thread_safe.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "net/http/http_transaction_factory.h" | 14 #include "net/http/http_transaction_factory.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 class ClientSocketFactory; | 18 class ClientSocketFactory; |
| 19 class DnsRRResolver; | 19 class DnsRRResolver; |
| 20 class HostResolver; | 20 class HostResolver; |
| 21 class HttpAuthHandlerFactory; | 21 class HttpAuthHandlerFactory; |
| 22 class HttpNetworkDelegate; | 22 class HttpNetworkDelegate; |
| 23 class HttpNetworkSession; | 23 class HttpNetworkSession; |
| 24 class NetLog; | 24 class NetLog; |
| 25 class ProxyService; | 25 class ProxyService; |
| 26 class SpdySessionPool; | 26 class SpdySessionPool; |
| 27 class SSLConfigService; | 27 class SSLConfigService; |
| 28 class SSLHostInfoFactory; |
| 28 | 29 |
| 29 class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe { | 30 class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe { |
| 30 public: | 31 public: |
| 31 // |socket_factory|, |proxy_service| and |host_resolver| must remain valid for | 32 // |socket_factory|, |proxy_service| and |host_resolver| must remain valid for |
| 32 // the lifetime of HttpNetworkLayer. | 33 // the lifetime of HttpNetworkLayer. |
| 33 HttpNetworkLayer(ClientSocketFactory* socket_factory, | 34 HttpNetworkLayer(ClientSocketFactory* socket_factory, |
| 34 HostResolver* host_resolver, | 35 HostResolver* host_resolver, |
| 35 DnsRRResolver* dnsrr_resolver, | 36 DnsRRResolver* dnsrr_resolver, |
| 37 SSLHostInfoFactory* ssl_host_info_factory, |
| 36 ProxyService* proxy_service, | 38 ProxyService* proxy_service, |
| 37 SSLConfigService* ssl_config_service, | 39 SSLConfigService* ssl_config_service, |
| 38 HttpAuthHandlerFactory* http_auth_handler_factory, | 40 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 39 HttpNetworkDelegate* network_delegate, | 41 HttpNetworkDelegate* network_delegate, |
| 40 NetLog* net_log); | 42 NetLog* net_log); |
| 41 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which | 43 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which |
| 42 // contains a valid ProxyService. | 44 // contains a valid ProxyService. |
| 43 HttpNetworkLayer( | 45 HttpNetworkLayer( |
| 44 ClientSocketFactory* socket_factory, | 46 ClientSocketFactory* socket_factory, |
| 45 HostResolver* host_resolver, | 47 HostResolver* host_resolver, |
| 46 DnsRRResolver* dnsrr_resolver, | 48 DnsRRResolver* dnsrr_resolver, |
| 49 SSLHostInfoFactory* ssl_host_info_factory, |
| 47 ProxyService* proxy_service, | 50 ProxyService* proxy_service, |
| 48 SSLConfigService* ssl_config_service, | 51 SSLConfigService* ssl_config_service, |
| 49 SpdySessionPool* spdy_session_pool, | 52 SpdySessionPool* spdy_session_pool, |
| 50 HttpAuthHandlerFactory* http_auth_handler_factory, | 53 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 51 HttpNetworkDelegate* network_delegate, | 54 HttpNetworkDelegate* network_delegate, |
| 52 NetLog* net_log); | 55 NetLog* net_log); |
| 53 | 56 |
| 54 explicit HttpNetworkLayer(HttpNetworkSession* session); | 57 explicit HttpNetworkLayer(HttpNetworkSession* session); |
| 55 ~HttpNetworkLayer(); | 58 ~HttpNetworkLayer(); |
| 56 | 59 |
| 57 // This function hides the details of how a network layer gets instantiated | 60 // This function hides the details of how a network layer gets instantiated |
| 58 // and allows other implementations to be substituted. | 61 // and allows other implementations to be substituted. |
| 59 static HttpTransactionFactory* CreateFactory( | 62 static HttpTransactionFactory* CreateFactory( |
| 60 HostResolver* host_resolver, | 63 HostResolver* host_resolver, |
| 61 DnsRRResolver* dnsrr_resolver, | 64 DnsRRResolver* dnsrr_resolver, |
| 65 SSLHostInfoFactory* ssl_host_info_factory, |
| 62 ProxyService* proxy_service, | 66 ProxyService* proxy_service, |
| 63 SSLConfigService* ssl_config_service, | 67 SSLConfigService* ssl_config_service, |
| 64 HttpAuthHandlerFactory* http_auth_handler_factory, | 68 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 65 HttpNetworkDelegate* network_delegate, | 69 HttpNetworkDelegate* network_delegate, |
| 66 NetLog* net_log); | 70 NetLog* net_log); |
| 67 // Create a transaction factory that instantiate a network layer over an | 71 // Create a transaction factory that instantiate a network layer over an |
| 68 // existing network session. Network session contains some valuable | 72 // existing network session. Network session contains some valuable |
| 69 // information (e.g. authentication data) that we want to share across | 73 // information (e.g. authentication data) that we want to share across |
| 70 // multiple network layers. This method exposes the implementation details | 74 // multiple network layers. This method exposes the implementation details |
| 71 // of a network layer, use this method with an existing network layer only | 75 // of a network layer, use this method with an existing network layer only |
| (...skipping 17 matching lines...) Expand all Loading... |
| 89 static void EnableSpdy(const std::string& mode); | 93 static void EnableSpdy(const std::string& mode); |
| 90 | 94 |
| 91 private: | 95 private: |
| 92 // The factory we will use to create network sockets. | 96 // The factory we will use to create network sockets. |
| 93 ClientSocketFactory* socket_factory_; | 97 ClientSocketFactory* socket_factory_; |
| 94 | 98 |
| 95 // The host resolver and proxy service that will be used when lazily | 99 // The host resolver and proxy service that will be used when lazily |
| 96 // creating |session_|. | 100 // creating |session_|. |
| 97 HostResolver* host_resolver_; | 101 HostResolver* host_resolver_; |
| 98 DnsRRResolver* dnsrr_resolver_; | 102 DnsRRResolver* dnsrr_resolver_; |
| 103 SSLHostInfoFactory* ssl_host_info_factory_; |
| 99 scoped_refptr<ProxyService> proxy_service_; | 104 scoped_refptr<ProxyService> proxy_service_; |
| 100 | 105 |
| 101 // The SSL config service being used for the session. | 106 // The SSL config service being used for the session. |
| 102 scoped_refptr<SSLConfigService> ssl_config_service_; | 107 scoped_refptr<SSLConfigService> ssl_config_service_; |
| 103 | 108 |
| 104 scoped_refptr<HttpNetworkSession> session_; | 109 scoped_refptr<HttpNetworkSession> session_; |
| 105 scoped_ptr<SpdySessionPool> spdy_session_pool_; | 110 scoped_ptr<SpdySessionPool> spdy_session_pool_; |
| 106 | 111 |
| 107 HttpAuthHandlerFactory* http_auth_handler_factory_; | 112 HttpAuthHandlerFactory* http_auth_handler_factory_; |
| 108 HttpNetworkDelegate* network_delegate_; | 113 HttpNetworkDelegate* network_delegate_; |
| 109 NetLog* net_log_; | 114 NetLog* net_log_; |
| 110 | 115 |
| 111 bool suspended_; | 116 bool suspended_; |
| 112 }; | 117 }; |
| 113 | 118 |
| 114 } // namespace net | 119 } // namespace net |
| 115 | 120 |
| 116 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ | 121 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ |
| OLD | NEW |