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

Side by Side 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: Responding to review comments. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 #ifndef NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_
6 #define NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/memory/singleton.h"
11 #include "net/base/completion_callback.h"
12 #include "net/url_request/url_request_context.h"
13
14 namespace net {
15
16 class DhcpProxyScriptFetcher;
17
18 // Factory object (non-singleton) for creating the appropriate concrete base
eroman 2011/05/13 05:03:32 What do you mean by non-singleton? This is in fact
Jói 2011/05/13 20:19:09 I commented that way because you use it via static
19 // class of DhcpProxyScriptFetcher for your operating system and settings.
20 //
21 // You might think we could just implement a DHCP client at the protocol
22 // level and have cross-platform support for retrieving PAC configuration
23 // from DHCP, but unfortunately the DHCP protocol assumes there is a single
24 // client per machine (specifically per network interface card), and there
25 // is an implicit state machine between the client and server, so adding a
26 // second client to the machine would not be advisable (see e.g. some
27 // discussion of what can happen at this URL:
28 // http://www.net.princeton.edu/multi-dhcp-one-interface-handling.html).
29 //
30 // Therefore, we have platform-specific implementations, and so we use
31 // this factory to select the right one.
32 class DhcpProxyScriptFetcherFactory {
33 public:
34 // Ownership is transferred to the caller. url_request_context must be valid
35 // and its lifetime must exceed that of the returned DhcpProxyScriptFetcher.
36 //
37 // Note that while a request is in progress, the fetcher may be holding a
38 // reference to |url_request_context|. Be careful not to create cycles
39 // between the fetcher and the context; you can break such cycles by calling
40 // Cancel().
41 static DhcpProxyScriptFetcher* Create(URLRequestContext* url_request_context);
42
43 // Attempts to enable/disable the DHCP WPAD feature. Does nothing
44 // if |IsSupported()| returns false.
45 //
46 // The feature is disabled by default, for now.
47 static void SetEnabled(bool enabled);
48
49 // Returns true if the DHCP WPAD feature is enabled. Always returns
50 // false if |IsSupported()| is false.
51 static bool IsEnabled();
52
53 // Returns true if the DHCP WPAD feature is supported on the current
54 // operating system.
55 static bool IsSupported();
56
57 protected:
58 static bool feature_enabled_;
59
60 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherFactory);
61 };
62
63 } // namespace net
64
65 #endif // NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698