| 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 CertVerifier; |
| 18 class ClientSocketFactory; | 19 class ClientSocketFactory; |
| 19 class DnsCertProvenanceChecker; | 20 class DnsCertProvenanceChecker; |
| 20 class DnsRRResolver; | 21 class DnsRRResolver; |
| 21 class HostResolver; | 22 class HostResolver; |
| 22 class HttpAuthHandlerFactory; | 23 class HttpAuthHandlerFactory; |
| 23 class HttpNetworkDelegate; | 24 class HttpNetworkDelegate; |
| 24 class HttpNetworkSession; | 25 class HttpNetworkSession; |
| 25 class NetLog; | 26 class NetLog; |
| 26 class ProxyService; | 27 class ProxyService; |
| 27 class SpdySessionPool; | 28 class SpdySessionPool; |
| 28 class SSLConfigService; | 29 class SSLConfigService; |
| 29 class SSLHostInfoFactory; | 30 class SSLHostInfoFactory; |
| 30 | 31 |
| 31 class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe { | 32 class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe { |
| 32 public: | 33 public: |
| 33 // |socket_factory|, |proxy_service| and |host_resolver| must remain valid for | 34 // |socket_factory|, |proxy_service|, |host_resolver|, etc. must remain |
| 34 // the lifetime of HttpNetworkLayer. | 35 // valid for the lifetime of HttpNetworkLayer. |
| 36 // TODO(wtc): we only need the next constructor. |
| 35 HttpNetworkLayer(ClientSocketFactory* socket_factory, | 37 HttpNetworkLayer(ClientSocketFactory* socket_factory, |
| 36 HostResolver* host_resolver, | 38 HostResolver* host_resolver, |
| 39 CertVerifier* cert_verifier, |
| 37 DnsRRResolver* dnsrr_resolver, | 40 DnsRRResolver* dnsrr_resolver, |
| 38 DnsCertProvenanceChecker* dns_cert_checker, | 41 DnsCertProvenanceChecker* dns_cert_checker, |
| 39 SSLHostInfoFactory* ssl_host_info_factory, | 42 SSLHostInfoFactory* ssl_host_info_factory, |
| 40 ProxyService* proxy_service, | 43 ProxyService* proxy_service, |
| 41 SSLConfigService* ssl_config_service, | 44 SSLConfigService* ssl_config_service, |
| 42 HttpAuthHandlerFactory* http_auth_handler_factory, | 45 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 43 HttpNetworkDelegate* network_delegate, | 46 HttpNetworkDelegate* network_delegate, |
| 44 NetLog* net_log); | 47 NetLog* net_log); |
| 45 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which | |
| 46 // contains a valid ProxyService. | |
| 47 HttpNetworkLayer( | 48 HttpNetworkLayer( |
| 48 ClientSocketFactory* socket_factory, | 49 ClientSocketFactory* socket_factory, |
| 49 HostResolver* host_resolver, | 50 HostResolver* host_resolver, |
| 51 CertVerifier* cert_verifier, |
| 50 DnsRRResolver* dnsrr_resolver, | 52 DnsRRResolver* dnsrr_resolver, |
| 51 DnsCertProvenanceChecker* dns_cert_checker, | 53 DnsCertProvenanceChecker* dns_cert_checker, |
| 52 SSLHostInfoFactory* ssl_host_info_factory, | 54 SSLHostInfoFactory* ssl_host_info_factory, |
| 53 ProxyService* proxy_service, | 55 ProxyService* proxy_service, |
| 54 SSLConfigService* ssl_config_service, | 56 SSLConfigService* ssl_config_service, |
| 55 SpdySessionPool* spdy_session_pool, | 57 SpdySessionPool* spdy_session_pool, |
| 56 HttpAuthHandlerFactory* http_auth_handler_factory, | 58 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 57 HttpNetworkDelegate* network_delegate, | 59 HttpNetworkDelegate* network_delegate, |
| 58 NetLog* net_log); | 60 NetLog* net_log); |
| 59 | 61 |
| 62 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which |
| 63 // contains a valid ProxyService. |
| 60 explicit HttpNetworkLayer(HttpNetworkSession* session); | 64 explicit HttpNetworkLayer(HttpNetworkSession* session); |
| 61 ~HttpNetworkLayer(); | 65 ~HttpNetworkLayer(); |
| 62 | 66 |
| 63 // This function hides the details of how a network layer gets instantiated | 67 // This function hides the details of how a network layer gets instantiated |
| 64 // and allows other implementations to be substituted. | 68 // and allows other implementations to be substituted. |
| 65 static HttpTransactionFactory* CreateFactory( | 69 static HttpTransactionFactory* CreateFactory( |
| 66 HostResolver* host_resolver, | 70 HostResolver* host_resolver, |
| 71 CertVerifier* cert_verifier, |
| 67 DnsRRResolver* dnsrr_resolver, | 72 DnsRRResolver* dnsrr_resolver, |
| 68 DnsCertProvenanceChecker* dns_cert_checker, | 73 DnsCertProvenanceChecker* dns_cert_checker, |
| 69 SSLHostInfoFactory* ssl_host_info_factory, | 74 SSLHostInfoFactory* ssl_host_info_factory, |
| 70 ProxyService* proxy_service, | 75 ProxyService* proxy_service, |
| 71 SSLConfigService* ssl_config_service, | 76 SSLConfigService* ssl_config_service, |
| 72 HttpAuthHandlerFactory* http_auth_handler_factory, | 77 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 73 HttpNetworkDelegate* network_delegate, | 78 HttpNetworkDelegate* network_delegate, |
| 74 NetLog* net_log); | 79 NetLog* net_log); |
| 75 // Create a transaction factory that instantiate a network layer over an | 80 // Create a transaction factory that instantiate a network layer over an |
| 76 // existing network session. Network session contains some valuable | 81 // existing network session. Network session contains some valuable |
| (...skipping 16 matching lines...) Expand all Loading... |
| 93 // "no-ssl" : disables SSL. | 98 // "no-ssl" : disables SSL. |
| 94 // "no-compress" : disables compression. | 99 // "no-compress" : disables compression. |
| 95 // "flow-control": enables flow control. | 100 // "flow-control": enables flow control. |
| 96 // "none" : disables both SSL and compression. | 101 // "none" : disables both SSL and compression. |
| 97 static void EnableSpdy(const std::string& mode); | 102 static void EnableSpdy(const std::string& mode); |
| 98 | 103 |
| 99 private: | 104 private: |
| 100 // The factory we will use to create network sockets. | 105 // The factory we will use to create network sockets. |
| 101 ClientSocketFactory* socket_factory_; | 106 ClientSocketFactory* socket_factory_; |
| 102 | 107 |
| 103 // The host resolver and proxy service that will be used when lazily | 108 // The host resolver, proxy service, etc. that will be used when lazily |
| 104 // creating |session_|. | 109 // creating |session_|. |
| 105 HostResolver* host_resolver_; | 110 HostResolver* host_resolver_; |
| 111 CertVerifier* cert_verifier_; |
| 106 DnsRRResolver* dnsrr_resolver_; | 112 DnsRRResolver* dnsrr_resolver_; |
| 107 DnsCertProvenanceChecker* dns_cert_checker_; | 113 DnsCertProvenanceChecker* dns_cert_checker_; |
| 108 SSLHostInfoFactory* ssl_host_info_factory_; | 114 SSLHostInfoFactory* ssl_host_info_factory_; |
| 109 scoped_refptr<ProxyService> proxy_service_; | 115 scoped_refptr<ProxyService> proxy_service_; |
| 110 | 116 |
| 111 // The SSL config service being used for the session. | 117 // The SSL config service being used for the session. |
| 112 scoped_refptr<SSLConfigService> ssl_config_service_; | 118 scoped_refptr<SSLConfigService> ssl_config_service_; |
| 113 | 119 |
| 114 scoped_refptr<HttpNetworkSession> session_; | 120 scoped_refptr<HttpNetworkSession> session_; |
| 115 scoped_ptr<SpdySessionPool> spdy_session_pool_; | 121 scoped_ptr<SpdySessionPool> spdy_session_pool_; |
| 116 | 122 |
| 117 HttpAuthHandlerFactory* http_auth_handler_factory_; | 123 HttpAuthHandlerFactory* http_auth_handler_factory_; |
| 118 HttpNetworkDelegate* network_delegate_; | 124 HttpNetworkDelegate* network_delegate_; |
| 119 NetLog* net_log_; | 125 NetLog* net_log_; |
| 120 | 126 |
| 121 bool suspended_; | 127 bool suspended_; |
| 122 }; | 128 }; |
| 123 | 129 |
| 124 } // namespace net | 130 } // namespace net |
| 125 | 131 |
| 126 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ | 132 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ |
| OLD | NEW |