Index: net/proxy/dhcp_proxy_script_fetcher_factory.cc |
diff --git a/net/proxy/dhcp_proxy_script_fetcher_factory.cc b/net/proxy/dhcp_proxy_script_fetcher_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d842c4e4e23e448431925bf41d5bb91eeb0e8055 |
--- /dev/null |
+++ b/net/proxy/dhcp_proxy_script_fetcher_factory.cc |
@@ -0,0 +1,59 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
+ |
+#include "net/base/net_errors.h" |
+#include "net/proxy/dhcp_proxy_script_fetcher.h" |
+ |
+#if defined(OS_WIN) |
+#include "net/proxy/dhcp_proxy_script_fetcher_win.h" |
+#endif |
+ |
+namespace net { |
+ |
+DhcpProxyScriptFetcherFactory* DhcpProxyScriptFetcherFactory::GetInstance() { |
+ return Singleton<DhcpProxyScriptFetcherFactory>::get(); |
+} |
+ |
+DhcpProxyScriptFetcher* DhcpProxyScriptFetcherFactory::Create( |
+ URLRequestContext* context) const { |
+ if (!feature_enabled_) { |
+ return new DoNothingDhcpProxyScriptFetcher(); |
+ } else { |
+ DCHECK(IsSupported()); |
+ DhcpProxyScriptFetcher* ret = NULL; |
+#if defined(OS_WIN) |
+ ret = new WindowsDhcpProxyScriptFetcher(context); |
+#endif |
+ DCHECK(ret); |
+ return ret; |
+ } |
+} |
+ |
+void DhcpProxyScriptFetcherFactory::SetEnabled(bool enabled) { |
+ if (IsSupported()) { |
+ feature_enabled_ = enabled; |
+ } |
+} |
+ |
+bool DhcpProxyScriptFetcherFactory::IsEnabled() const { |
+ return feature_enabled_; |
+} |
+ |
+bool DhcpProxyScriptFetcherFactory::IsSupported() { |
+#if defined(OS_WIN) |
+ return true; |
+#else |
+ return false; |
+#endif |
+} |
+ |
+DhcpProxyScriptFetcherFactory::DhcpProxyScriptFetcherFactory() |
+ : feature_enabled_(false) { |
+} |
+ |
+DhcpProxyScriptFetcherFactory::~DhcpProxyScriptFetcherFactory() {} |
+ |
+} // namespace net |