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_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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "net/proxy/proxy_server.h" | 21 #include "net/proxy/proxy_server.h" |
22 | 22 |
23 class GURL; | 23 class GURL; |
24 class MessageLoop; | 24 class MessageLoop; |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 | 27 |
28 class HostResolver; | 28 class HostResolver; |
29 class InitProxyResolver; | 29 class InitProxyResolver; |
30 class ProxyResolver; | 30 class ProxyResolver; |
31 class ProxyScriptFetcher; | 31 class URLProxyScriptFetcher; |
32 class URLRequestContext; | 32 class URLRequestContext; |
33 | 33 |
34 // This class can be used to resolve the proxy server to use when loading a | 34 // This class can be used to resolve the proxy server to use when loading a |
35 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy | 35 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy |
36 // resolution. See ProxyResolverV8 for example. | 36 // resolution. See ProxyResolverV8 for example. |
37 class ProxyService : public base::RefCounted<ProxyService>, | 37 class ProxyService : public base::RefCounted<ProxyService>, |
38 public NetworkChangeNotifier::IPAddressObserver, | 38 public NetworkChangeNotifier::IPAddressObserver, |
39 public ProxyConfigService::Observer, | 39 public ProxyConfigService::Observer, |
40 public base::NonThreadSafe { | 40 public base::NonThreadSafe { |
41 public: | 41 public: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 CompletionCallback* callback, | 92 CompletionCallback* callback, |
93 PacRequest** pac_request, | 93 PacRequest** pac_request, |
94 const BoundNetLog& net_log); | 94 const BoundNetLog& net_log); |
95 | 95 |
96 // Call this method with a non-null |pac_request| to cancel the PAC request. | 96 // Call this method with a non-null |pac_request| to cancel the PAC request. |
97 void CancelPacRequest(PacRequest* pac_request); | 97 void CancelPacRequest(PacRequest* pac_request); |
98 | 98 |
99 // Sets the ProxyScriptFetcher dependency. This is needed if the ProxyResolver | 99 // Sets the ProxyScriptFetcher dependency. This is needed if the ProxyResolver |
100 // is of type ProxyResolverWithoutFetch. ProxyService takes ownership of | 100 // is of type ProxyResolverWithoutFetch. ProxyService takes ownership of |
101 // |proxy_script_fetcher|. | 101 // |proxy_script_fetcher|. |
102 void SetProxyScriptFetcher(ProxyScriptFetcher* proxy_script_fetcher); | 102 void SetProxyScriptFetcher(URLProxyScriptFetcher* proxy_script_fetcher); |
103 ProxyScriptFetcher* GetProxyScriptFetcher() const; | 103 URLProxyScriptFetcher* GetProxyScriptFetcher() const; |
104 | 104 |
105 // Tells this ProxyService to start using a new ProxyConfigService to | 105 // Tells this ProxyService to start using a new ProxyConfigService to |
106 // retrieve its ProxyConfig from. The new ProxyConfigService will immediately | 106 // retrieve its ProxyConfig from. The new ProxyConfigService will immediately |
107 // be queried for new config info which will be used for all subsequent | 107 // be queried for new config info which will be used for all subsequent |
108 // ResolveProxy calls. ProxyService takes ownership of | 108 // ResolveProxy calls. ProxyService takes ownership of |
109 // |new_proxy_config_service|. | 109 // |new_proxy_config_service|. |
110 void ResetConfigService(ProxyConfigService* new_proxy_config_service); | 110 void ResetConfigService(ProxyConfigService* new_proxy_config_service); |
111 | 111 |
112 // Tells the resolver to purge any memory it does not need. | 112 // Tells the resolver to purge any memory it does not need. |
113 void PurgeMemory(); | 113 void PurgeMemory(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // lifetime of the ProxyService. | 164 // lifetime of the ProxyService. |
165 // | 165 // |
166 // ########################################################################## | 166 // ########################################################################## |
167 // # See the warnings in net/proxy/proxy_resolver_v8.h describing the | 167 // # See the warnings in net/proxy/proxy_resolver_v8.h describing the |
168 // # multi-threading model. In order for this to be safe to use, *ALL* the | 168 // # multi-threading model. In order for this to be safe to use, *ALL* the |
169 // # other V8's running in the process must use v8::Locker. | 169 // # other V8's running in the process must use v8::Locker. |
170 // ########################################################################## | 170 // ########################################################################## |
171 static ProxyService* CreateUsingV8ProxyResolver( | 171 static ProxyService* CreateUsingV8ProxyResolver( |
172 ProxyConfigService* proxy_config_service, | 172 ProxyConfigService* proxy_config_service, |
173 size_t num_pac_threads, | 173 size_t num_pac_threads, |
174 ProxyScriptFetcher* proxy_script_fetcher, | 174 URLProxyScriptFetcher* proxy_script_fetcher, |
175 HostResolver* host_resolver, | 175 HostResolver* host_resolver, |
176 NetLog* net_log); | 176 NetLog* net_log); |
177 | 177 |
178 // Same as CreateUsingV8ProxyResolver, except it uses system libraries | 178 // Same as CreateUsingV8ProxyResolver, except it uses system libraries |
179 // for evaluating the PAC script if available, otherwise skips | 179 // for evaluating the PAC script if available, otherwise skips |
180 // proxy autoconfig. | 180 // proxy autoconfig. |
181 static ProxyService* CreateUsingSystemProxyResolver( | 181 static ProxyService* CreateUsingSystemProxyResolver( |
182 ProxyConfigService* proxy_config_service, | 182 ProxyConfigService* proxy_config_service, |
183 size_t num_pac_threads, | 183 size_t num_pac_threads, |
184 NetLog* net_log); | 184 NetLog* net_log); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 // Map of the known bad proxies and the information about the retry time. | 311 // Map of the known bad proxies and the information about the retry time. |
312 ProxyRetryInfoMap proxy_retry_info_; | 312 ProxyRetryInfoMap proxy_retry_info_; |
313 | 313 |
314 // Set of pending/inprogress requests. | 314 // Set of pending/inprogress requests. |
315 PendingRequests pending_requests_; | 315 PendingRequests pending_requests_; |
316 | 316 |
317 // The fetcher to use when downloading PAC scripts for the ProxyResolver. | 317 // The fetcher to use when downloading PAC scripts for the ProxyResolver. |
318 // This dependency can be NULL if our ProxyResolver has no need for | 318 // This dependency can be NULL if our ProxyResolver has no need for |
319 // external PAC script fetching. | 319 // external PAC script fetching. |
320 scoped_ptr<ProxyScriptFetcher> proxy_script_fetcher_; | 320 scoped_ptr<URLProxyScriptFetcher> proxy_script_fetcher_; |
321 | 321 |
322 // Callback for when |init_proxy_resolver_| is done. | 322 // Callback for when |init_proxy_resolver_| is done. |
323 CompletionCallbackImpl<ProxyService> init_proxy_resolver_callback_; | 323 CompletionCallbackImpl<ProxyService> init_proxy_resolver_callback_; |
324 | 324 |
325 // Helper to download the PAC script (wpad + custom) and apply fallback rules. | 325 // Helper to download the PAC script (wpad + custom) and apply fallback rules. |
326 // | 326 // |
327 // Note that the declaration is important here: |proxy_script_fetcher_| and | 327 // Note that the declaration is important here: |proxy_script_fetcher_| and |
328 // |proxy_resolver_| must outlive |init_proxy_resolver_|. | 328 // |proxy_resolver_| must outlive |init_proxy_resolver_|. |
329 scoped_ptr<InitProxyResolver> init_proxy_resolver_; | 329 scoped_ptr<InitProxyResolver> init_proxy_resolver_; |
330 | 330 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 base::WaitableEvent event_; | 374 base::WaitableEvent event_; |
375 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; | 375 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; |
376 ProxyInfo proxy_info_; | 376 ProxyInfo proxy_info_; |
377 int result_; | 377 int result_; |
378 }; | 378 }; |
379 | 379 |
380 } // namespace net | 380 } // namespace net |
381 | 381 |
382 #endif // NET_PROXY_PROXY_SERVICE_H_ | 382 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |