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

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

Issue 8896019: Refactor: Extract "InitProxyResolver" to "ProxyScriptDecider". (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: do another sync since commitbot failed... 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
« no previous file with comments | « net/proxy/proxy_script_decider_unittest.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PROXY_SERVICE_H_ 5 #ifndef NET_PROXY_PROXY_SERVICE_H_
6 #define NET_PROXY_PROXY_SERVICE_H_ 6 #define NET_PROXY_PROXY_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 12 matching lines...) Expand all
23 #include "net/proxy/proxy_info.h" 23 #include "net/proxy/proxy_info.h"
24 #include "net/proxy/proxy_server.h" 24 #include "net/proxy/proxy_server.h"
25 25
26 class GURL; 26 class GURL;
27 class MessageLoop; 27 class MessageLoop;
28 28
29 namespace net { 29 namespace net {
30 30
31 class DhcpProxyScriptFetcher; 31 class DhcpProxyScriptFetcher;
32 class HostResolver; 32 class HostResolver;
33 class InitProxyResolver;
34 class NetworkDelegate; 33 class NetworkDelegate;
35 class ProxyResolver; 34 class ProxyResolver;
35 class ProxyScriptDecider;
36 class ProxyScriptFetcher; 36 class ProxyScriptFetcher;
37 37
38 // This class can be used to resolve the proxy server to use when loading a 38 // This class can be used to resolve the proxy server to use when loading a
39 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy 39 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy
40 // resolution. See ProxyResolverV8 for example. 40 // resolution. See ProxyResolverV8 for example.
41 class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver, 41 class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
42 public ProxyConfigService::Observer, 42 public ProxyConfigService::Observer,
43 NON_EXPORTED_BASE(public base::NonThreadSafe) { 43 NON_EXPORTED_BASE(public base::NonThreadSafe) {
44 public: 44 public:
45 // The instance takes ownership of |config_service| and |resolver|. 45 // The instance takes ownership of |config_service| and |resolver|.
(...skipping 14 matching lines...) Expand all
60 // callback is run. The callback is run on the thread that calls 60 // callback is run. The callback is run on the thread that calls
61 // ResolveProxy. 61 // ResolveProxy.
62 // 62 //
63 // The caller is responsible for ensuring that |results| and |callback| 63 // The caller is responsible for ensuring that |results| and |callback|
64 // remain valid until the callback is run or until |pac_request| is cancelled 64 // remain valid until the callback is run or until |pac_request| is cancelled
65 // via CancelPacRequest. |pac_request| is only valid while the completion 65 // via CancelPacRequest. |pac_request| is only valid while the completion
66 // callback is still pending. NULL can be passed for |pac_request| if 66 // callback is still pending. NULL can be passed for |pac_request| if
67 // the caller will not need to cancel the request. 67 // the caller will not need to cancel the request.
68 // 68 //
69 // We use the three possible proxy access types in the following order, 69 // We use the three possible proxy access types in the following order,
70 // doing fallback if one doesn't work. See "init_proxy_resolver.h" 70 // doing fallback if one doesn't work. See "pac_script_decider.h"
71 // for the specifics. 71 // for the specifics.
72 // 1. WPAD auto-detection 72 // 1. WPAD auto-detection
73 // 2. PAC URL 73 // 2. PAC URL
74 // 3. named proxy 74 // 3. named proxy
75 // 75 //
76 // Profiling information for the request is saved to |net_log| if non-NULL. 76 // Profiling information for the request is saved to |net_log| if non-NULL.
77 int ResolveProxy(const GURL& url, 77 int ResolveProxy(const GURL& url,
78 ProxyInfo* results, 78 ProxyInfo* results,
79 OldCompletionCallback* callback, 79 OldCompletionCallback* callback,
80 PacRequest** pac_request, 80 PacRequest** pac_request,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 // This method should only be used by unit tests. 239 // This method should only be used by unit tests.
240 void set_stall_proxy_auto_config_delay(base::TimeDelta delay) { 240 void set_stall_proxy_auto_config_delay(base::TimeDelta delay) {
241 stall_proxy_auto_config_delay_ = delay; 241 stall_proxy_auto_config_delay_ = delay;
242 } 242 }
243 243
244 private: 244 private:
245 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); 245 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect);
246 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect); 246 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect);
247 friend class PacRequest; 247 friend class PacRequest;
248 class InitProxyResolver;
248 249
249 // TODO(eroman): change this to a std::set. Note that this requires updating 250 // TODO(eroman): change this to a std::set. Note that this requires updating
250 // some tests in proxy_service_unittest.cc such as: 251 // some tests in proxy_service_unittest.cc such as:
251 // ProxyServiceTest.InitialPACScriptDownload 252 // ProxyServiceTest.InitialPACScriptDownload
252 // which expects requests to finish in the order they were added. 253 // which expects requests to finish in the order they were added.
253 typedef std::vector<scoped_refptr<PacRequest> > PendingRequests; 254 typedef std::vector<scoped_refptr<PacRequest> > PendingRequests;
254 255
255 enum State { 256 enum State {
256 STATE_NONE, 257 STATE_NONE,
257 STATE_WAITING_FOR_PROXY_CONFIG, 258 STATE_WAITING_FOR_PROXY_CONFIG,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 405
405 base::WaitableEvent event_; 406 base::WaitableEvent event_;
406 OldCompletionCallbackImpl<SyncProxyServiceHelper> callback_; 407 OldCompletionCallbackImpl<SyncProxyServiceHelper> callback_;
407 ProxyInfo proxy_info_; 408 ProxyInfo proxy_info_;
408 int result_; 409 int result_;
409 }; 410 };
410 411
411 } // namespace net 412 } // namespace net
412 413
413 #endif // NET_PROXY_PROXY_SERVICE_H_ 414 #endif // NET_PROXY_PROXY_SERVICE_H_
OLDNEW
« no previous file with comments | « net/proxy/proxy_script_decider_unittest.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698