OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_FACTORY_H_ | 5 #ifndef NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_FACTORY_H_ |
6 #define NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_FACTORY_H_ | 6 #define NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_FACTORY_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // client per machine (specifically per network interface card), and there | 26 // client per machine (specifically per network interface card), and there |
27 // is an implicit state machine between the client and server, so adding a | 27 // is an implicit state machine between the client and server, so adding a |
28 // second client to the machine would not be advisable (see e.g. some | 28 // second client to the machine would not be advisable (see e.g. some |
29 // discussion of what can happen at this URL: | 29 // discussion of what can happen at this URL: |
30 // http://www.net.princeton.edu/multi-dhcp-one-interface-handling.html). | 30 // http://www.net.princeton.edu/multi-dhcp-one-interface-handling.html). |
31 // | 31 // |
32 // Therefore, we have platform-specific implementations, and so we use | 32 // Therefore, we have platform-specific implementations, and so we use |
33 // this factory to select the right one. | 33 // this factory to select the right one. |
34 class NET_EXPORT DhcpProxyScriptFetcherFactory { | 34 class NET_EXPORT DhcpProxyScriptFetcherFactory { |
35 public: | 35 public: |
36 // Creates a new factory object with default settings. | |
37 DhcpProxyScriptFetcherFactory(); | 36 DhcpProxyScriptFetcherFactory(); |
38 | 37 |
| 38 virtual ~DhcpProxyScriptFetcherFactory(); |
| 39 |
39 // url_request_context must be valid and its lifetime must exceed that of the | 40 // url_request_context must be valid and its lifetime must exceed that of the |
40 // returned DhcpProxyScriptFetcher. | 41 // returned DhcpProxyScriptFetcher. |
41 // | 42 // |
42 // Note that while a request is in progress, the fetcher may be holding a | 43 // Note that while a request is in progress, the fetcher may be holding a |
43 // reference to |url_request_context|. Be careful not to create cycles | 44 // reference to |url_request_context|. Be careful not to create cycles |
44 // between the fetcher and the context; you can break such cycles by calling | 45 // between the fetcher and the context; you can break such cycles by calling |
45 // Cancel(). | 46 // Cancel(). |
46 std::unique_ptr<DhcpProxyScriptFetcher> Create( | 47 virtual std::unique_ptr<DhcpProxyScriptFetcher> Create( |
47 URLRequestContext* url_request_context); | 48 URLRequestContext* url_request_context); |
48 | 49 |
49 // Attempts to enable/disable the DHCP WPAD feature. Does nothing | |
50 // if |IsSupported()| returns false. | |
51 // | |
52 // The default is |enabled() == true|. | |
53 void set_enabled(bool enabled); | |
54 | |
55 // Returns true if the DHCP WPAD feature is enabled. Always returns | |
56 // false if |IsSupported()| is false. | |
57 bool enabled() const; | |
58 | |
59 // Returns true if the DHCP WPAD feature is supported on the current | |
60 // operating system. | |
61 static bool IsSupported(); | |
62 | |
63 private: | 50 private: |
64 bool feature_enabled_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(DhcpProxyScriptFetcherFactory); | 51 DISALLOW_COPY_AND_ASSIGN(DhcpProxyScriptFetcherFactory); |
67 }; | 52 }; |
68 | 53 |
69 } // namespace net | 54 } // namespace net |
70 | 55 |
71 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_FACTORY_H_ | 56 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_FACTORY_H_ |
OLD | NEW |