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_H_ | 5 #ifndef NET_PROXY_DHCP_SCRIPT_FETCHER_H_ |
6 #define NET_PROXY_DHCP_SCRIPT_FETCHER_H_ | 6 #define NET_PROXY_DHCP_SCRIPT_FETCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
13 #include "net/base/net_api.h" | 13 #include "net/base/net_export.h" |
14 #include "net/proxy/proxy_script_fetcher.h" | 14 #include "net/proxy/proxy_script_fetcher.h" |
15 #include "net/url_request/url_request_context.h" | 15 #include "net/url_request/url_request_context.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 // Interface for classes that can fetch a proxy script as configured via DHCP. | 19 // Interface for classes that can fetch a proxy script as configured via DHCP. |
20 // | 20 // |
21 // The Fetch method on this interface tries to retrieve the most appropriate | 21 // The Fetch method on this interface tries to retrieve the most appropriate |
22 // PAC script configured via DHCP. | 22 // PAC script configured via DHCP. |
23 // | 23 // |
24 // Normally there are zero or one DHCP scripts configured, but in the | 24 // Normally there are zero or one DHCP scripts configured, but in the |
25 // presence of multiple adapters with DHCP enabled, the fetcher resolves | 25 // presence of multiple adapters with DHCP enabled, the fetcher resolves |
26 // which PAC script to use if one or more are available. | 26 // which PAC script to use if one or more are available. |
27 class NET_TEST DhcpProxyScriptFetcher { | 27 class NET_EXPORT_PRIVATE DhcpProxyScriptFetcher { |
28 public: | 28 public: |
29 // Destruction should cancel any outstanding requests. | 29 // Destruction should cancel any outstanding requests. |
30 virtual ~DhcpProxyScriptFetcher(); | 30 virtual ~DhcpProxyScriptFetcher(); |
31 | 31 |
32 // Attempts to retrieve the most appropriate PAC script configured via DHCP, | 32 // Attempts to retrieve the most appropriate PAC script configured via DHCP, |
33 // and invokes |callback| on completion. | 33 // and invokes |callback| on completion. |
34 // | 34 // |
35 // Returns OK on success, otherwise the error code. If the return code is | 35 // Returns OK on success, otherwise the error code. If the return code is |
36 // ERR_IO_PENDING, then the request completes asynchronously, and |callback| | 36 // ERR_IO_PENDING, then the request completes asynchronously, and |callback| |
37 // will be invoked later with the final error code. | 37 // will be invoked later with the final error code. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 protected: | 74 protected: |
75 DhcpProxyScriptFetcher(); | 75 DhcpProxyScriptFetcher(); |
76 | 76 |
77 private: | 77 private: |
78 DISALLOW_COPY_AND_ASSIGN(DhcpProxyScriptFetcher); | 78 DISALLOW_COPY_AND_ASSIGN(DhcpProxyScriptFetcher); |
79 }; | 79 }; |
80 | 80 |
81 // A do-nothing retriever, always returns synchronously with | 81 // A do-nothing retriever, always returns synchronously with |
82 // ERR_NOT_IMPLEMENTED result and empty text. | 82 // ERR_NOT_IMPLEMENTED result and empty text. |
83 class NET_TEST DoNothingDhcpProxyScriptFetcher : public DhcpProxyScriptFetcher { | 83 class NET_EXPORT_PRIVATE DoNothingDhcpProxyScriptFetcher |
| 84 : public DhcpProxyScriptFetcher { |
84 public: | 85 public: |
85 DoNothingDhcpProxyScriptFetcher(); | 86 DoNothingDhcpProxyScriptFetcher(); |
86 virtual ~DoNothingDhcpProxyScriptFetcher(); | 87 virtual ~DoNothingDhcpProxyScriptFetcher(); |
87 | 88 |
88 virtual int Fetch(string16* utf16_text, | 89 virtual int Fetch(string16* utf16_text, |
89 CompletionCallback* callback) OVERRIDE; | 90 CompletionCallback* callback) OVERRIDE; |
90 virtual void Cancel() OVERRIDE; | 91 virtual void Cancel() OVERRIDE; |
91 virtual const GURL& GetPacURL() const OVERRIDE; | 92 virtual const GURL& GetPacURL() const OVERRIDE; |
92 private: | 93 private: |
93 GURL gurl_; | 94 GURL gurl_; |
94 DISALLOW_COPY_AND_ASSIGN(DoNothingDhcpProxyScriptFetcher); | 95 DISALLOW_COPY_AND_ASSIGN(DoNothingDhcpProxyScriptFetcher); |
95 }; | 96 }; |
96 | 97 |
97 } // namespace net | 98 } // namespace net |
98 | 99 |
99 #endif // NET_PROXY_DHCP_SCRIPT_FETCHER_H_ | 100 #endif // NET_PROXY_DHCP_SCRIPT_FETCHER_H_ |
OLD | NEW |