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_WIN_H_ | 5 #ifndef NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ |
6 #define NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ | 6 #define NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Creates a DhcpProxyScriptFetcherWin that issues requests through | 37 // Creates a DhcpProxyScriptFetcherWin that issues requests through |
38 // |url_request_context|. |url_request_context| must remain valid for | 38 // |url_request_context|. |url_request_context| must remain valid for |
39 // the lifetime of DhcpProxyScriptFetcherWin. | 39 // the lifetime of DhcpProxyScriptFetcherWin. |
40 explicit DhcpProxyScriptFetcherWin(URLRequestContext* url_request_context); | 40 explicit DhcpProxyScriptFetcherWin(URLRequestContext* url_request_context); |
41 ~DhcpProxyScriptFetcherWin() override; | 41 ~DhcpProxyScriptFetcherWin() override; |
42 | 42 |
43 // DhcpProxyScriptFetcher implementation. | 43 // DhcpProxyScriptFetcher implementation. |
44 int Fetch(base::string16* utf16_text, | 44 int Fetch(base::string16* utf16_text, |
45 const CompletionCallback& callback) override; | 45 const CompletionCallback& callback) override; |
46 void Cancel() override; | 46 void Cancel() override; |
| 47 void OnShutdown() override; |
47 const GURL& GetPacURL() const override; | 48 const GURL& GetPacURL() const override; |
48 std::string GetFetcherName() const override; | 49 std::string GetFetcherName() const override; |
49 | 50 |
50 // Sets |adapter_names| to contain the name of each network adapter on | 51 // Sets |adapter_names| to contain the name of each network adapter on |
51 // this machine that has DHCP enabled and is not a loop-back adapter. Returns | 52 // this machine that has DHCP enabled and is not a loop-back adapter. Returns |
52 // false on error. | 53 // false on error. |
53 static bool GetCandidateAdapterNames(std::set<std::string>* adapter_names); | 54 static bool GetCandidateAdapterNames(std::set<std::string>* adapter_names); |
54 | 55 |
55 protected: | 56 protected: |
56 int num_pending_fetchers() const; | 57 int num_pending_fetchers() const; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 159 |
159 // Pointer to string we will write results to. Not valid in states | 160 // Pointer to string we will write results to. Not valid in states |
160 // START and DONE. | 161 // START and DONE. |
161 base::string16* destination_string_; | 162 base::string16* destination_string_; |
162 | 163 |
163 // PAC URL retrieved from DHCP, if any. Valid only in state STATE_DONE. | 164 // PAC URL retrieved from DHCP, if any. Valid only in state STATE_DONE. |
164 GURL pac_url_; | 165 GURL pac_url_; |
165 | 166 |
166 base::OneShotTimer wait_timer_; | 167 base::OneShotTimer wait_timer_; |
167 | 168 |
168 URLRequestContext* const url_request_context_; | 169 // Set to nullptr on cancellation. |
| 170 URLRequestContext* url_request_context_; |
169 | 171 |
170 // NULL or the AdapterQuery currently in flight. | 172 // NULL or the AdapterQuery currently in flight. |
171 scoped_refptr<AdapterQuery> last_query_; | 173 scoped_refptr<AdapterQuery> last_query_; |
172 | 174 |
173 // Time |Fetch()| was last called, 0 if never. | 175 // Time |Fetch()| was last called, 0 if never. |
174 base::TimeTicks fetch_start_time_; | 176 base::TimeTicks fetch_start_time_; |
175 | 177 |
176 // Worker pool we use for all DHCP lookup tasks. | 178 // Worker pool we use for all DHCP lookup tasks. |
177 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 179 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
178 | 180 |
179 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherWin); | 181 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherWin); |
180 }; | 182 }; |
181 | 183 |
182 } // namespace net | 184 } // namespace net |
183 | 185 |
184 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ | 186 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ |
OLD | NEW |