| 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 HttpNetworkSession; | 19 class HttpNetworkSession; |
| 20 class NetLog; |
| 20 class NetworkChangeNotifier; | 21 class NetworkChangeNotifier; |
| 21 class ProxyInfo; | 22 class ProxyInfo; |
| 22 class ProxyService; | 23 class ProxyService; |
| 23 class SpdySessionPool; | 24 class SpdySessionPool; |
| 24 class SSLConfigService; | 25 class SSLConfigService; |
| 25 | 26 |
| 26 class HttpNetworkLayer : public HttpTransactionFactory { | 27 class HttpNetworkLayer : public HttpTransactionFactory { |
| 27 public: | 28 public: |
| 28 // |socket_factory|, |network_change_notifier|, |proxy_service| and | 29 // |socket_factory|, |network_change_notifier|, |proxy_service| and |
| 29 // |host_resolver| must remain valid for the lifetime of HttpNetworkLayer. | 30 // |host_resolver| must remain valid for the lifetime of HttpNetworkLayer. |
| 30 HttpNetworkLayer(ClientSocketFactory* socket_factory, | 31 HttpNetworkLayer(ClientSocketFactory* socket_factory, |
| 31 NetworkChangeNotifier* network_change_notifier, | 32 NetworkChangeNotifier* network_change_notifier, |
| 32 HostResolver* host_resolver, ProxyService* proxy_service, | 33 HostResolver* host_resolver, ProxyService* proxy_service, |
| 33 SSLConfigService* ssl_config_service, | 34 SSLConfigService* ssl_config_service, |
| 34 HttpAuthHandlerFactory* http_auth_handler_factory); | 35 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 36 NetLog* net_log); |
| 35 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which | 37 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which |
| 36 // contains a valid ProxyService. | 38 // contains a valid ProxyService. |
| 37 explicit HttpNetworkLayer(HttpNetworkSession* session); | 39 explicit HttpNetworkLayer(HttpNetworkSession* session); |
| 38 ~HttpNetworkLayer(); | 40 ~HttpNetworkLayer(); |
| 39 | 41 |
| 40 // This function hides the details of how a network layer gets instantiated | 42 // This function hides the details of how a network layer gets instantiated |
| 41 // and allows other implementations to be substituted. | 43 // and allows other implementations to be substituted. |
| 42 static HttpTransactionFactory* CreateFactory( | 44 static HttpTransactionFactory* CreateFactory( |
| 43 NetworkChangeNotifier* network_change_notifier, | 45 NetworkChangeNotifier* network_change_notifier, |
| 44 HostResolver* host_resolver, | 46 HostResolver* host_resolver, |
| 45 ProxyService* proxy_service, | 47 ProxyService* proxy_service, |
| 46 SSLConfigService* ssl_config_service, | 48 SSLConfigService* ssl_config_service, |
| 47 HttpAuthHandlerFactory* http_auth_handler_factory); | 49 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 50 NetLog* net_log); |
| 48 // Create a transaction factory that instantiate a network layer over an | 51 // Create a transaction factory that instantiate a network layer over an |
| 49 // existing network session. Network session contains some valuable | 52 // existing network session. Network session contains some valuable |
| 50 // information (e.g. authentication data) that we want to share across | 53 // information (e.g. authentication data) that we want to share across |
| 51 // multiple network layers. This method exposes the implementation details | 54 // multiple network layers. This method exposes the implementation details |
| 52 // of a network layer, use this method with an existing network layer only | 55 // of a network layer, use this method with an existing network layer only |
| 53 // when network session is shared. | 56 // when network session is shared. |
| 54 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session); | 57 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session); |
| 55 | 58 |
| 56 // HttpTransactionFactory methods: | 59 // HttpTransactionFactory methods: |
| 57 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); | 60 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 scoped_refptr<HostResolver> host_resolver_; | 81 scoped_refptr<HostResolver> host_resolver_; |
| 79 scoped_refptr<ProxyService> proxy_service_; | 82 scoped_refptr<ProxyService> proxy_service_; |
| 80 | 83 |
| 81 // The SSL config service being used for the session. | 84 // The SSL config service being used for the session. |
| 82 scoped_refptr<SSLConfigService> ssl_config_service_; | 85 scoped_refptr<SSLConfigService> ssl_config_service_; |
| 83 | 86 |
| 84 scoped_refptr<HttpNetworkSession> session_; | 87 scoped_refptr<HttpNetworkSession> session_; |
| 85 scoped_refptr<SpdySessionPool> spdy_session_pool_; | 88 scoped_refptr<SpdySessionPool> spdy_session_pool_; |
| 86 | 89 |
| 87 HttpAuthHandlerFactory* http_auth_handler_factory_; | 90 HttpAuthHandlerFactory* http_auth_handler_factory_; |
| 91 NetLog* net_log_; |
| 88 | 92 |
| 89 bool suspended_; | 93 bool suspended_; |
| 90 static bool force_spdy_; | 94 static bool force_spdy_; |
| 91 }; | 95 }; |
| 92 | 96 |
| 93 } // namespace net | 97 } // namespace net |
| 94 | 98 |
| 95 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ | 99 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ |
| OLD | NEW |