Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: net/proxy/dhcp_proxy_script_fetcher_win.h

Issue 8985012: base::Bind: Convert net/proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 17 matching lines...) Expand all
28 public base::SupportsWeakPtr<DhcpProxyScriptFetcherWin>, 28 public base::SupportsWeakPtr<DhcpProxyScriptFetcherWin>,
29 NON_EXPORTED_BASE(public base::NonThreadSafe) { 29 NON_EXPORTED_BASE(public base::NonThreadSafe) {
30 public: 30 public:
31 // Creates a DhcpProxyScriptFetcherWin that issues requests through 31 // Creates a DhcpProxyScriptFetcherWin that issues requests through
32 // |url_request_context|. |url_request_context| must remain valid for 32 // |url_request_context|. |url_request_context| must remain valid for
33 // the lifetime of DhcpProxyScriptFetcherWin. 33 // the lifetime of DhcpProxyScriptFetcherWin.
34 explicit DhcpProxyScriptFetcherWin(URLRequestContext* url_request_context); 34 explicit DhcpProxyScriptFetcherWin(URLRequestContext* url_request_context);
35 virtual ~DhcpProxyScriptFetcherWin(); 35 virtual ~DhcpProxyScriptFetcherWin();
36 36
37 // DhcpProxyScriptFetcher implementation. 37 // DhcpProxyScriptFetcher implementation.
38 int Fetch(string16* utf16_text, OldCompletionCallback* callback) OVERRIDE; 38 int Fetch(string16* utf16_text,
39 const net::CompletionCallback& callback) OVERRIDE;
39 void Cancel() OVERRIDE; 40 void Cancel() OVERRIDE;
40 const GURL& GetPacURL() const OVERRIDE; 41 const GURL& GetPacURL() const OVERRIDE;
41 std::string GetFetcherName() const OVERRIDE; 42 std::string GetFetcherName() const OVERRIDE;
42 43
43 // Sets |adapter_names| to contain the name of each network adapter on 44 // Sets |adapter_names| to contain the name of each network adapter on
44 // this machine that has DHCP enabled and is not a loop-back adapter. Returns 45 // this machine that has DHCP enabled and is not a loop-back adapter. Returns
45 // false on error. 46 // false on error.
46 static bool GetCandidateAdapterNames(std::set<std::string>* adapter_names); 47 static bool GetCandidateAdapterNames(std::set<std::string>* adapter_names);
47 48
48 protected: 49 protected:
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 132
132 // Current state of this state machine. 133 // Current state of this state machine.
133 State state_; 134 State state_;
134 135
135 // Vector, in Windows' network adapter preference order, of 136 // Vector, in Windows' network adapter preference order, of
136 // DhcpProxyScriptAdapterFetcher objects that are or were attempting 137 // DhcpProxyScriptAdapterFetcher objects that are or were attempting
137 // to fetch a PAC file based on DHCP configuration. 138 // to fetch a PAC file based on DHCP configuration.
138 typedef ScopedVector<DhcpProxyScriptAdapterFetcher> FetcherVector; 139 typedef ScopedVector<DhcpProxyScriptAdapterFetcher> FetcherVector;
139 FetcherVector fetchers_; 140 FetcherVector fetchers_;
140 141
141 // Callback invoked when any fetcher completes.
142 OldCompletionCallbackImpl<DhcpProxyScriptFetcherWin> fetcher_callback_;
143
144 // Number of fetchers we are waiting for. 142 // Number of fetchers we are waiting for.
145 int num_pending_fetchers_; 143 int num_pending_fetchers_;
146 144
147 // Lets our client know we're done. Not valid in states START or DONE. 145 // Lets our client know we're done. Not valid in states START or DONE.
148 OldCompletionCallback* client_callback_; 146 net::CompletionCallback callback_;
149 147
150 // Pointer to string we will write results to. Not valid in states 148 // Pointer to string we will write results to. Not valid in states
151 // START and DONE. 149 // START and DONE.
152 string16* destination_string_; 150 string16* destination_string_;
153 151
154 // PAC URL retrieved from DHCP, if any. Valid only in state STATE_DONE. 152 // PAC URL retrieved from DHCP, if any. Valid only in state STATE_DONE.
155 GURL pac_url_; 153 GURL pac_url_;
156 154
157 base::OneShotTimer<DhcpProxyScriptFetcherWin> wait_timer_; 155 base::OneShotTimer<DhcpProxyScriptFetcherWin> wait_timer_;
158 156
159 scoped_refptr<URLRequestContext> url_request_context_; 157 scoped_refptr<URLRequestContext> url_request_context_;
160 158
161 // NULL or the AdapterQuery currently in flight. 159 // NULL or the AdapterQuery currently in flight.
162 scoped_refptr<AdapterQuery> last_query_; 160 scoped_refptr<AdapterQuery> last_query_;
163 161
164 // Time |Fetch()| was last called, 0 if never. 162 // Time |Fetch()| was last called, 0 if never.
165 base::TimeTicks fetch_start_time_; 163 base::TimeTicks fetch_start_time_;
166 164
167 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherWin); 165 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherWin);
168 }; 166 };
169 167
170 } // namespace net 168 } // namespace net
171 169
172 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ 170 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698