| 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 "base/scoped_ptr.h" |
| 10 #include "net/http/http_transaction_factory.h" | 10 #include "net/http/http_transaction_factory.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 class HttpNetworkSession; | 14 class HttpNetworkSession; |
| 15 class ProxyInfo; | 15 class ProxyInfo; |
| 16 class ProxyService; | 16 class ProxyService; |
| 17 | 17 |
| 18 class HttpNetworkLayer : public HttpTransactionFactory { | 18 class HttpNetworkLayer : public HttpTransactionFactory { |
| 19 public: | 19 public: |
| 20 // |proxy_service| must remain valid for the lifetime of HttpNetworkLayer. | |
| 21 explicit HttpNetworkLayer(ProxyService* proxy_service); | 20 explicit HttpNetworkLayer(ProxyService* proxy_service); |
| 22 ~HttpNetworkLayer(); | 21 ~HttpNetworkLayer(); |
| 23 | 22 |
| 24 // 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 |
| 25 // and allows other implementations to be substituted. | 24 // and allows other implementations to be substituted. |
| 26 static HttpTransactionFactory* CreateFactory(ProxyService* proxy_service); | 25 static HttpTransactionFactory* CreateFactory(ProxyService* proxy_service); |
| 27 | 26 |
| 28 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 29 // If value is true, then WinHTTP will be used. | 28 // If value is true, then WinHTTP will be used. |
| 30 static void UseWinHttp(bool value); | 29 static void UseWinHttp(bool value); |
| 31 #endif | 30 #endif |
| 32 | 31 |
| 33 // HttpTransactionFactory methods: | 32 // HttpTransactionFactory methods: |
| 34 virtual HttpTransaction* CreateTransaction(); | 33 virtual HttpTransaction* CreateTransaction(); |
| 35 virtual HttpCache* GetCache(); | 34 virtual HttpCache* GetCache(); |
| 36 virtual void Suspend(bool suspend); | 35 virtual void Suspend(bool suspend); |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 40 static bool use_winhttp_; | 39 static bool use_winhttp_; |
| 41 #endif | 40 #endif |
| 42 | 41 |
| 43 // The proxy service being used for the session. | 42 // The proxy service being used for the session. |
| 44 ProxyService* proxy_service_; | 43 scoped_refptr<ProxyService> proxy_service_; |
| 45 | 44 |
| 46 scoped_refptr<HttpNetworkSession> session_; | 45 scoped_refptr<HttpNetworkSession> session_; |
| 47 bool suspended_; | 46 bool suspended_; |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 } // namespace net | 49 } // namespace net |
| 51 | 50 |
| 52 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ | 51 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ |
| 53 | 52 |
| OLD | NEW |