| 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 #ifndef NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ | 5 #ifndef NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ |
| 6 #define NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ | 6 #define NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 11 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
| 12 #include "net/base/net_api.h" | 12 #include "net/base/net_export.h" |
| 13 #include "net/url_request/url_request_context.h" | 13 #include "net/url_request/url_request_context.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 class DhcpProxyScriptFetcher; | 17 class DhcpProxyScriptFetcher; |
| 18 | 18 |
| 19 // Factory object for creating the appropriate concrete base class of | 19 // Factory object for creating the appropriate concrete base class of |
| 20 // DhcpProxyScriptFetcher for your operating system and settings. | 20 // DhcpProxyScriptFetcher for your operating system and settings. |
| 21 // | 21 // |
| 22 // You might think we could just implement a DHCP client at the protocol | 22 // You might think we could just implement a DHCP client at the protocol |
| 23 // level and have cross-platform support for retrieving PAC configuration | 23 // level and have cross-platform support for retrieving PAC configuration |
| 24 // from DHCP, but unfortunately the DHCP protocol assumes there is a single | 24 // from DHCP, but unfortunately the DHCP protocol assumes there is a single |
| 25 // client per machine (specifically per network interface card), and there | 25 // client per machine (specifically per network interface card), and there |
| 26 // is an implicit state machine between the client and server, so adding a | 26 // is an implicit state machine between the client and server, so adding a |
| 27 // second client to the machine would not be advisable (see e.g. some | 27 // second client to the machine would not be advisable (see e.g. some |
| 28 // discussion of what can happen at this URL: | 28 // discussion of what can happen at this URL: |
| 29 // http://www.net.princeton.edu/multi-dhcp-one-interface-handling.html). | 29 // http://www.net.princeton.edu/multi-dhcp-one-interface-handling.html). |
| 30 // | 30 // |
| 31 // Therefore, we have platform-specific implementations, and so we use | 31 // Therefore, we have platform-specific implementations, and so we use |
| 32 // this factory to select the right one. | 32 // this factory to select the right one. |
| 33 class NET_API DhcpProxyScriptFetcherFactory { | 33 class NET_EXPORT DhcpProxyScriptFetcherFactory { |
| 34 public: | 34 public: |
| 35 // Creates a new factory object with default settings. | 35 // Creates a new factory object with default settings. |
| 36 DhcpProxyScriptFetcherFactory(); | 36 DhcpProxyScriptFetcherFactory(); |
| 37 | 37 |
| 38 // Ownership is transferred to the caller. url_request_context must be valid | 38 // Ownership is transferred to the caller. url_request_context must be valid |
| 39 // and its lifetime must exceed that of the returned DhcpProxyScriptFetcher. | 39 // and its lifetime must exceed that of the returned DhcpProxyScriptFetcher. |
| 40 // | 40 // |
| 41 // Note that while a request is in progress, the fetcher may be holding a | 41 // Note that while a request is in progress, the fetcher may be holding a |
| 42 // reference to |url_request_context|. Be careful not to create cycles | 42 // reference to |url_request_context|. Be careful not to create cycles |
| 43 // between the fetcher and the context; you can break such cycles by calling | 43 // between the fetcher and the context; you can break such cycles by calling |
| (...skipping 16 matching lines...) Expand all Loading... |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 bool feature_enabled_; | 62 bool feature_enabled_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(DhcpProxyScriptFetcherFactory); | 64 DISALLOW_COPY_AND_ASSIGN(DhcpProxyScriptFetcherFactory); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace net | 67 } // namespace net |
| 68 | 68 |
| 69 #endif // NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ | 69 #endif // NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ |
| OLD | NEW |