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