| 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 #include "net/http/http_network_layer.h" | 5 #include "net/http/http_network_layer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/base/client_socket_factory.h" | 8 #include "net/base/client_socket_factory.h" |
| 9 #include "net/http/http_network_session.h" | 9 #include "net/http/http_network_session.h" |
| 10 #include "net/http/http_network_transaction.h" | 10 #include "net/http/http_network_transaction.h" |
| 11 #if defined(OS_WIN) | |
| 12 #include "net/http/http_transaction_winhttp.h" | |
| 13 #endif | |
| 14 | 11 |
| 15 namespace net { | 12 namespace net { |
| 16 | 13 |
| 17 //----------------------------------------------------------------------------- | 14 //----------------------------------------------------------------------------- |
| 18 | 15 |
| 19 #if defined(OS_WIN) | |
| 20 // static | |
| 21 bool HttpNetworkLayer::use_winhttp_ = false; | |
| 22 #endif | |
| 23 | |
| 24 // static | 16 // static |
| 25 HttpTransactionFactory* HttpNetworkLayer::CreateFactory( | 17 HttpTransactionFactory* HttpNetworkLayer::CreateFactory( |
| 26 ProxyService* proxy_service) { | 18 ProxyService* proxy_service) { |
| 27 DCHECK(proxy_service); | 19 DCHECK(proxy_service); |
| 28 #if defined(OS_WIN) | |
| 29 if (use_winhttp_) | |
| 30 return new HttpTransactionWinHttp::Factory(proxy_service); | |
| 31 #endif | |
| 32 | 20 |
| 33 return new HttpNetworkLayer(proxy_service); | 21 return new HttpNetworkLayer(proxy_service); |
| 34 } | 22 } |
| 35 | 23 |
| 36 #if defined(OS_WIN) | |
| 37 // static | |
| 38 void HttpNetworkLayer::UseWinHttp(bool value) { | |
| 39 use_winhttp_ = value; | |
| 40 } | |
| 41 #endif | |
| 42 | |
| 43 //----------------------------------------------------------------------------- | 24 //----------------------------------------------------------------------------- |
| 44 | 25 |
| 45 HttpNetworkLayer::HttpNetworkLayer(ProxyService* proxy_service) | 26 HttpNetworkLayer::HttpNetworkLayer(ProxyService* proxy_service) |
| 46 : proxy_service_(proxy_service), suspended_(false) { | 27 : proxy_service_(proxy_service), suspended_(false) { |
| 47 DCHECK(proxy_service_); | 28 DCHECK(proxy_service_); |
| 48 } | 29 } |
| 49 | 30 |
| 50 HttpNetworkLayer::~HttpNetworkLayer() { | 31 HttpNetworkLayer::~HttpNetworkLayer() { |
| 51 } | 32 } |
| 52 | 33 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 | 48 |
| 68 void HttpNetworkLayer::Suspend(bool suspend) { | 49 void HttpNetworkLayer::Suspend(bool suspend) { |
| 69 suspended_ = suspend; | 50 suspended_ = suspend; |
| 70 | 51 |
| 71 if (suspend && session_) | 52 if (suspend && session_) |
| 72 session_->connection_pool()->CloseIdleSockets(); | 53 session_->connection_pool()->CloseIdleSockets(); |
| 73 } | 54 } |
| 74 | 55 |
| 75 } // namespace net | 56 } // namespace net |
| 76 | 57 |
| OLD | NEW |