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