OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
| 6 |
| 7 #include "net/base/net_errors.h" |
| 8 #include "net/proxy/dhcp_proxy_script_fetcher.h" |
| 9 |
| 10 #if defined(OS_WIN) |
| 11 #include "net/proxy/dhcp_proxy_script_fetcher_win.h" |
| 12 #endif |
| 13 |
| 14 namespace net { |
| 15 |
| 16 bool DhcpProxyScriptFetcherFactory::feature_enabled_ = false; |
| 17 |
| 18 // static |
| 19 DhcpProxyScriptFetcher* DhcpProxyScriptFetcherFactory::Create( |
| 20 URLRequestContext* context) { |
| 21 if (!feature_enabled_) { |
| 22 return new DoNothingDhcpProxyScriptFetcher(); |
| 23 } else { |
| 24 DCHECK(IsSupported()); |
| 25 DhcpProxyScriptFetcher* ret = NULL; |
| 26 #if defined(OS_WIN) |
| 27 ret = new WindowsDhcpProxyScriptFetcher(context); |
| 28 #endif |
| 29 DCHECK(ret); |
| 30 return ret; |
| 31 } |
| 32 } |
| 33 |
| 34 // static |
| 35 void DhcpProxyScriptFetcherFactory::SetEnabled(bool enabled) { |
| 36 if (IsSupported()) { |
| 37 feature_enabled_ = enabled; |
| 38 } |
| 39 } |
| 40 |
| 41 // static |
| 42 bool DhcpProxyScriptFetcherFactory::IsEnabled() { |
| 43 return feature_enabled_; |
| 44 } |
| 45 |
| 46 // static |
| 47 bool DhcpProxyScriptFetcherFactory::IsSupported() { |
| 48 #if defined(OS_WIN) |
| 49 return true; |
| 50 #else |
| 51 return false; |
| 52 #endif |
| 53 } |
| 54 |
| 55 } // namespace net |
OLD | NEW |