| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/proxy/dhcp_proxy_script_fetcher_factory.h" | 5 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "net/proxy/dhcp_proxy_script_fetcher.h" | 9 #include "net/proxy/dhcp_proxy_script_fetcher.h" |
| 10 | 10 |
| 11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 12 #include "net/proxy/dhcp_proxy_script_fetcher_win.h" | 12 #include "net/proxy/dhcp_proxy_script_fetcher_win.h" |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 DhcpProxyScriptFetcherFactory::DhcpProxyScriptFetcherFactory() | 17 DhcpProxyScriptFetcherFactory::DhcpProxyScriptFetcherFactory() |
| 18 : feature_enabled_(false) { | 18 : feature_enabled_(false) { |
| 19 set_enabled(true); | 19 set_enabled(true); |
| 20 } | 20 } |
| 21 | 21 |
| 22 std::unique_ptr<DhcpProxyScriptFetcher> DhcpProxyScriptFetcherFactory::Create( | 22 std::unique_ptr<DhcpProxyScriptFetcher> DhcpProxyScriptFetcherFactory::Create( |
| 23 URLRequestContext* context) { | 23 URLRequestContext* context) { |
| 24 if (!feature_enabled_) { | 24 if (!feature_enabled_) { |
| 25 return base::WrapUnique(new DoNothingDhcpProxyScriptFetcher()); | 25 return base::MakeUnique<DoNothingDhcpProxyScriptFetcher>(); |
| 26 } else { | 26 } else { |
| 27 DCHECK(IsSupported()); | 27 DCHECK(IsSupported()); |
| 28 std::unique_ptr<DhcpProxyScriptFetcher> ret; | 28 std::unique_ptr<DhcpProxyScriptFetcher> ret; |
| 29 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 30 ret.reset(new DhcpProxyScriptFetcherWin(context)); | 30 ret.reset(new DhcpProxyScriptFetcherWin(context)); |
| 31 #endif | 31 #endif |
| 32 DCHECK(ret); | 32 DCHECK(ret); |
| 33 return ret; | 33 return ret; |
| 34 } | 34 } |
| 35 } | 35 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 47 // static | 47 // static |
| 48 bool DhcpProxyScriptFetcherFactory::IsSupported() { | 48 bool DhcpProxyScriptFetcherFactory::IsSupported() { |
| 49 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
| 50 return true; | 50 return true; |
| 51 #else | 51 #else |
| 52 return false; | 52 return false; |
| 53 #endif | 53 #endif |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace net | 56 } // namespace net |
| OLD | NEW |