| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "net/http/http_transaction_factory.h" | 12 #include "net/http/http_transaction_factory.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 class ClientSocketFactory; | 16 class ClientSocketFactory; |
| 17 class HostResolver; | 17 class HostResolver; |
| 18 class HttpAuthHandlerFactory; | 18 class HttpAuthHandlerFactory; |
| 19 class HttpNetworkDelegate; | 19 class HttpNetworkDelegate; |
| 20 class HttpNetworkSession; | 20 class HttpNetworkSession; |
| 21 class NetLog; | 21 class NetLog; |
| 22 class NetworkChangeNotifier; | |
| 23 class ProxyInfo; | 22 class ProxyInfo; |
| 24 class ProxyService; | 23 class ProxyService; |
| 25 class SpdySessionPool; | 24 class SpdySessionPool; |
| 26 class SSLConfigService; | 25 class SSLConfigService; |
| 27 | 26 |
| 28 class HttpNetworkLayer : public HttpTransactionFactory { | 27 class HttpNetworkLayer : public HttpTransactionFactory { |
| 29 public: | 28 public: |
| 30 // |socket_factory|, |network_change_notifier|, |proxy_service| and | 29 // |socket_factory|, |proxy_service| and |host_resolver| must remain valid for |
| 31 // |host_resolver| must remain valid for the lifetime of HttpNetworkLayer. | 30 // the lifetime of HttpNetworkLayer. |
| 32 HttpNetworkLayer(ClientSocketFactory* socket_factory, | 31 HttpNetworkLayer(ClientSocketFactory* socket_factory, |
| 33 NetworkChangeNotifier* network_change_notifier, | 32 HostResolver* host_resolver, |
| 34 HostResolver* host_resolver, ProxyService* proxy_service, | 33 ProxyService* proxy_service, |
| 35 SSLConfigService* ssl_config_service, | 34 SSLConfigService* ssl_config_service, |
| 36 HttpAuthHandlerFactory* http_auth_handler_factory, | 35 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 37 HttpNetworkDelegate* network_delegate, | 36 HttpNetworkDelegate* network_delegate, |
| 38 NetLog* net_log); | 37 NetLog* net_log); |
| 39 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which | 38 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which |
| 40 // contains a valid ProxyService. | 39 // contains a valid ProxyService. |
| 41 explicit HttpNetworkLayer(HttpNetworkSession* session); | 40 explicit HttpNetworkLayer(HttpNetworkSession* session); |
| 42 ~HttpNetworkLayer(); | 41 ~HttpNetworkLayer(); |
| 43 | 42 |
| 44 // This function hides the details of how a network layer gets instantiated | 43 // This function hides the details of how a network layer gets instantiated |
| 45 // and allows other implementations to be substituted. | 44 // and allows other implementations to be substituted. |
| 46 static HttpTransactionFactory* CreateFactory( | 45 static HttpTransactionFactory* CreateFactory( |
| 47 NetworkChangeNotifier* network_change_notifier, | |
| 48 HostResolver* host_resolver, | 46 HostResolver* host_resolver, |
| 49 ProxyService* proxy_service, | 47 ProxyService* proxy_service, |
| 50 SSLConfigService* ssl_config_service, | 48 SSLConfigService* ssl_config_service, |
| 51 HttpAuthHandlerFactory* http_auth_handler_factory, | 49 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 52 HttpNetworkDelegate* network_delegate, | 50 HttpNetworkDelegate* network_delegate, |
| 53 NetLog* net_log); | 51 NetLog* net_log); |
| 54 // Create a transaction factory that instantiate a network layer over an | 52 // Create a transaction factory that instantiate a network layer over an |
| 55 // existing network session. Network session contains some valuable | 53 // existing network session. Network session contains some valuable |
| 56 // information (e.g. authentication data) that we want to share across | 54 // information (e.g. authentication data) that we want to share across |
| 57 // multiple network layers. This method exposes the implementation details | 55 // multiple network layers. This method exposes the implementation details |
| (...skipping 12 matching lines...) Expand all Loading... |
| 70 // "" : (default) SSL and compression are enabled. | 68 // "" : (default) SSL and compression are enabled. |
| 71 // "no-ssl" : disables SSL. | 69 // "no-ssl" : disables SSL. |
| 72 // "no-compress" : disables compression. | 70 // "no-compress" : disables compression. |
| 73 // "none" : disables both SSL and compression. | 71 // "none" : disables both SSL and compression. |
| 74 static void EnableSpdy(const std::string& mode); | 72 static void EnableSpdy(const std::string& mode); |
| 75 | 73 |
| 76 private: | 74 private: |
| 77 // The factory we will use to create network sockets. | 75 // The factory we will use to create network sockets. |
| 78 ClientSocketFactory* socket_factory_; | 76 ClientSocketFactory* socket_factory_; |
| 79 | 77 |
| 80 NetworkChangeNotifier* network_change_notifier_; | |
| 81 | |
| 82 // The host resolver and proxy service that will be used when lazily | 78 // The host resolver and proxy service that will be used when lazily |
| 83 // creating |session_|. | 79 // creating |session_|. |
| 84 scoped_refptr<HostResolver> host_resolver_; | 80 scoped_refptr<HostResolver> host_resolver_; |
| 85 scoped_refptr<ProxyService> proxy_service_; | 81 scoped_refptr<ProxyService> proxy_service_; |
| 86 | 82 |
| 87 // The SSL config service being used for the session. | 83 // The SSL config service being used for the session. |
| 88 scoped_refptr<SSLConfigService> ssl_config_service_; | 84 scoped_refptr<SSLConfigService> ssl_config_service_; |
| 89 | 85 |
| 90 scoped_refptr<HttpNetworkSession> session_; | 86 scoped_refptr<HttpNetworkSession> session_; |
| 91 scoped_refptr<SpdySessionPool> spdy_session_pool_; | 87 scoped_refptr<SpdySessionPool> spdy_session_pool_; |
| 92 | 88 |
| 93 HttpAuthHandlerFactory* http_auth_handler_factory_; | 89 HttpAuthHandlerFactory* http_auth_handler_factory_; |
| 94 HttpNetworkDelegate* network_delegate_; | 90 HttpNetworkDelegate* network_delegate_; |
| 95 NetLog* net_log_; | 91 NetLog* net_log_; |
| 96 | 92 |
| 97 bool suspended_; | 93 bool suspended_; |
| 98 static bool force_spdy_; | 94 static bool force_spdy_; |
| 99 }; | 95 }; |
| 100 | 96 |
| 101 } // namespace net | 97 } // namespace net |
| 102 | 98 |
| 103 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ | 99 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ |
| OLD | NEW |