Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Unified Diff: net/proxy/dhcp_proxy_script_fetcher_factory.h

Issue 6831025: Adds support for the DHCP portion of the WPAD (proxy auto-discovery) protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leaks in unit test. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/proxy/dhcp_proxy_script_fetcher_factory.h
diff --git a/net/proxy/dhcp_proxy_script_fetcher_factory.h b/net/proxy/dhcp_proxy_script_fetcher_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..20e4104d8ee88e22ebb3131edb0093cfa53ed2f0
--- /dev/null
+++ b/net/proxy/dhcp_proxy_script_fetcher_factory.h
@@ -0,0 +1,68 @@
+// 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.
+
+#ifndef NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_
+#define NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/memory/singleton.h"
+#include "net/base/completion_callback.h"
+#include "net/url_request/url_request_context.h"
+
+namespace net {
+
+class DhcpProxyScriptFetcher;
+
+// Factory object for creating the appropriate concrete base class of
+// DhcpProxyScriptFetcher for your operating system and settings.
+//
+// You might think we could just implement a DHCP client at the protocol
+// level and have cross-platform support for retrieving PAC configuration
+// from DHCP, but unfortunately the DHCP protocol assumes there is a single
+// client per machine (specifically per network interface card), and there
+// is an implicit state machine between the client and server, so adding a
+// second client to the machine would not be advisable (see e.g. some
+// discussion of what can happen at this URL:
+// http://www.net.princeton.edu/multi-dhcp-one-interface-handling.html).
+//
+// Therefore, we have platform-specific implementations, and so we use
+// this factory to select the right one.
+class DhcpProxyScriptFetcherFactory {
+ public:
+ // Creates a new factory object with default settings.
+ DhcpProxyScriptFetcherFactory();
+
+ // Ownership is transferred to the caller. url_request_context must be valid
+ // and its lifetime must exceed that of the returned DhcpProxyScriptFetcher.
+ //
+ // Note that while a request is in progress, the fetcher may be holding a
+ // reference to |url_request_context|. Be careful not to create cycles
+ // between the fetcher and the context; you can break such cycles by calling
+ // Cancel().
+ DhcpProxyScriptFetcher* Create(URLRequestContext* url_request_context);
+
+ // Attempts to enable/disable the DHCP WPAD feature. Does nothing
+ // if |IsSupported()| returns false.
+ //
+ // The current default is |enabled() == false|.
+ void set_enabled(bool enabled);
+
+ // Returns true if the DHCP WPAD feature is enabled. Always returns
+ // false if |IsSupported()| is false.
+ bool enabled() const;
+
+ // Returns true if the DHCP WPAD feature is supported on the current
+ // operating system.
+ static bool IsSupported();
+
+ protected:
+ bool feature_enabled_;
+
+ DISALLOW_COPY_AND_ASSIGN(DhcpProxyScriptFetcherFactory);
+};
+
+} // namespace net
+
+#endif // NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698