| 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. |  20   // |proxy_service| must remain valid for the lifetime of HttpNetworkLayer. | 
|  21   explicit HttpNetworkLayer(ProxyService* proxy_service); |  21   explicit HttpNetworkLayer(ProxyService* proxy_service); | 
|  22   ~HttpNetworkLayer(); |  22   ~HttpNetworkLayer(); | 
|  23  |  23  | 
|  24   // This function hides the details of how a network layer gets instantiated |  24   // This function hides the details of how a network layer gets instantiated | 
|  25   // and allows other implementations to be substituted. |  25   // and allows other implementations to be substituted. | 
|  26   static HttpTransactionFactory* CreateFactory(ProxyService* proxy_service); |  26   static HttpTransactionFactory* CreateFactory(ProxyService* proxy_service); | 
|  27  |  27  | 
|  28 #if defined(OS_WIN) |  | 
|  29   // If value is true, then WinHTTP will be used. |  | 
|  30   static void UseWinHttp(bool value); |  | 
|  31 #endif |  | 
|  32  |  | 
|  33   // HttpTransactionFactory methods: |  28   // HttpTransactionFactory methods: | 
|  34   virtual HttpTransaction* CreateTransaction(); |  29   virtual HttpTransaction* CreateTransaction(); | 
|  35   virtual HttpCache* GetCache(); |  30   virtual HttpCache* GetCache(); | 
|  36   virtual void Suspend(bool suspend); |  31   virtual void Suspend(bool suspend); | 
|  37  |  32  | 
|  38  private: |  33  private: | 
|  39 #if defined(OS_WIN) |  | 
|  40   static bool use_winhttp_; |  | 
|  41 #endif |  | 
|  42  |  | 
|  43   // The proxy service being used for the session. |  34   // The proxy service being used for the session. | 
|  44   ProxyService* proxy_service_; |  35   ProxyService* proxy_service_; | 
|  45  |  36  | 
|  46   scoped_refptr<HttpNetworkSession> session_; |  37   scoped_refptr<HttpNetworkSession> session_; | 
|  47   bool suspended_; |  38   bool suspended_; | 
|  48 }; |  39 }; | 
|  49  |  40  | 
|  50 }  // namespace net |  41 }  // namespace net | 
|  51  |  42  | 
|  52 #endif  // NET_HTTP_HTTP_NETWORK_LAYER_H_ |  43 #endif  // NET_HTTP_HTTP_NETWORK_LAYER_H_ | 
|  53  |  44  | 
| OLD | NEW |