OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/scoped_ptr.h" |
9 #include "net/http/http_transaction_factory.h" | 10 #include "net/http/http_transaction_factory.h" |
10 | 11 |
11 namespace net { | 12 namespace net { |
12 | 13 |
13 class HttpNetworkSession; | 14 class HttpNetworkSession; |
14 class ProxyInfo; | 15 class ProxyInfo; |
| 16 class ProxyResolver; |
15 | 17 |
16 class HttpNetworkLayer : public HttpTransactionFactory { | 18 class HttpNetworkLayer : public HttpTransactionFactory { |
17 public: | 19 public: |
18 explicit HttpNetworkLayer(const ProxyInfo* pi); | 20 explicit HttpNetworkLayer(const ProxyInfo* pi); |
19 ~HttpNetworkLayer(); | 21 ~HttpNetworkLayer(); |
20 | 22 |
21 // This function hides the details of how a network layer gets instantiated | 23 // This function hides the details of how a network layer gets instantiated |
22 // and allows other implementations to be substituted. | 24 // and allows other implementations to be substituted. |
23 static HttpTransactionFactory* CreateFactory(const ProxyInfo* pi); | 25 static HttpTransactionFactory* CreateFactory(const ProxyInfo* pi); |
24 | 26 |
25 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
26 // If value is true, then WinHTTP will be used. | 28 // If value is true, then WinHTTP will be used. |
27 static void UseWinHttp(bool value); | 29 static void UseWinHttp(bool value); |
28 #endif | 30 #endif |
29 | 31 |
30 // HttpTransactionFactory methods: | 32 // HttpTransactionFactory methods: |
31 virtual HttpTransaction* CreateTransaction(); | 33 virtual HttpTransaction* CreateTransaction(); |
32 virtual HttpCache* GetCache(); | 34 virtual HttpCache* GetCache(); |
33 virtual AuthCache* GetAuthCache(); | 35 virtual AuthCache* GetAuthCache(); |
34 virtual void Suspend(bool suspend); | 36 virtual void Suspend(bool suspend); |
35 | 37 |
36 private: | 38 private: |
37 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
38 static bool use_winhttp_; | 40 static bool use_winhttp_; |
39 #endif | 41 #endif |
40 | 42 |
| 43 // The pending proxy resolver to use when lazily creating session_. |
| 44 // NULL afterwards. |
| 45 scoped_ptr<ProxyResolver> proxy_resolver_; |
| 46 |
41 scoped_refptr<HttpNetworkSession> session_; | 47 scoped_refptr<HttpNetworkSession> session_; |
42 bool suspended_; | 48 bool suspended_; |
43 }; | 49 }; |
44 | 50 |
45 } // namespace net | 51 } // namespace net |
46 | 52 |
47 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ | 53 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ |
48 | 54 |
OLD | NEW |