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" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // ERR_TIMED_OUT -- fetch took too long to complete. | 51 // ERR_TIMED_OUT -- fetch took too long to complete. |
52 // ERR_FILE_TOO_BIG -- response body was too large. | 52 // ERR_FILE_TOO_BIG -- response body was too large. |
53 // ERR_PAC_STATUS_NOT_OK -- script failed to download. | 53 // ERR_PAC_STATUS_NOT_OK -- script failed to download. |
54 // ERR_NOT_IMPLEMENTED -- script required authentication. | 54 // ERR_NOT_IMPLEMENTED -- script required authentication. |
55 // | 55 // |
56 // If the request is cancelled (either using the "Cancel()" method or by | 56 // If the request is cancelled (either using the "Cancel()" method or by |
57 // deleting |this|), then no callback is invoked. | 57 // deleting |this|), then no callback is invoked. |
58 // | 58 // |
59 // Only one fetch is allowed to be outstanding at a time. | 59 // Only one fetch is allowed to be outstanding at a time. |
60 virtual int Fetch(string16* utf16_text, | 60 virtual int Fetch(string16* utf16_text, |
61 OldCompletionCallback* callback) = 0; | 61 const CompletionCallback& callback) = 0; |
62 | 62 |
63 // Aborts the in-progress fetch (if any). | 63 // Aborts the in-progress fetch (if any). |
64 virtual void Cancel() = 0; | 64 virtual void Cancel() = 0; |
65 | 65 |
66 // After successful completion of |Fetch()|, this will return the URL | 66 // After successful completion of |Fetch()|, this will return the URL |
67 // retrieved from DHCP. It is reset if/when |Fetch()| is called again. | 67 // retrieved from DHCP. It is reset if/when |Fetch()| is called again. |
68 virtual const GURL& GetPacURL() const = 0; | 68 virtual const GURL& GetPacURL() const = 0; |
69 | 69 |
70 // Intended for unit tests only, so they can test that factories return | 70 // Intended for unit tests only, so they can test that factories return |
71 // the right types under given circumstances. | 71 // the right types under given circumstances. |
72 virtual std::string GetFetcherName() const; | 72 virtual std::string GetFetcherName() const; |
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_EXPORT_PRIVATE DoNothingDhcpProxyScriptFetcher | 83 class NET_EXPORT_PRIVATE DoNothingDhcpProxyScriptFetcher |
84 : public DhcpProxyScriptFetcher { | 84 : public DhcpProxyScriptFetcher { |
85 public: | 85 public: |
86 DoNothingDhcpProxyScriptFetcher(); | 86 DoNothingDhcpProxyScriptFetcher(); |
87 virtual ~DoNothingDhcpProxyScriptFetcher(); | 87 virtual ~DoNothingDhcpProxyScriptFetcher(); |
88 | 88 |
89 virtual int Fetch(string16* utf16_text, | 89 virtual int Fetch(string16* utf16_text, |
90 OldCompletionCallback* callback) OVERRIDE; | 90 const CompletionCallback& callback) OVERRIDE; |
91 virtual void Cancel() OVERRIDE; | 91 virtual void Cancel() OVERRIDE; |
92 virtual const GURL& GetPacURL() const OVERRIDE; | 92 virtual const GURL& GetPacURL() const OVERRIDE; |
93 private: | 93 private: |
94 GURL gurl_; | 94 GURL gurl_; |
95 DISALLOW_COPY_AND_ASSIGN(DoNothingDhcpProxyScriptFetcher); | 95 DISALLOW_COPY_AND_ASSIGN(DoNothingDhcpProxyScriptFetcher); |
96 }; | 96 }; |
97 | 97 |
98 } // namespace net | 98 } // namespace net |
99 | 99 |
100 #endif // NET_PROXY_DHCP_SCRIPT_FETCHER_H_ | 100 #endif // NET_PROXY_DHCP_SCRIPT_FETCHER_H_ |
OLD | NEW |