OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // This class can be used to resolve the proxy server to use when loading a | 32 // This class can be used to resolve the proxy server to use when loading a |
33 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy | 33 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy |
34 // resolution. See ProxyResolverV8 for example. | 34 // resolution. See ProxyResolverV8 for example. |
35 class ProxyService : public base::RefCountedThreadSafe<ProxyService>, | 35 class ProxyService : public base::RefCountedThreadSafe<ProxyService>, |
36 public NetworkChangeNotifier::Observer { | 36 public NetworkChangeNotifier::Observer { |
37 public: | 37 public: |
38 // The instance takes ownership of |config_service| and |resolver|. | 38 // The instance takes ownership of |config_service| and |resolver|. |
39 // If |network_change_notifier| is non-NULL, the proxy service will register | 39 // If |network_change_notifier| is non-NULL, the proxy service will register |
40 // with it to detect when the network setup has changed. This is used to | 40 // with it to detect when the network setup has changed. This is used to |
41 // decide when to re-configure the proxy discovery. | 41 // decide when to re-configure the proxy discovery. |
| 42 // |net_log| is a possibly NULL destination to send log events to. It must |
| 43 // remain alive for the lifetime of this ProxyService. |
42 ProxyService(ProxyConfigService* config_service, ProxyResolver* resolver, | 44 ProxyService(ProxyConfigService* config_service, ProxyResolver* resolver, |
43 NetworkChangeNotifier* network_change_notifier, | 45 NetworkChangeNotifier* network_change_notifier, |
44 const BoundNetLog& init_proxy_resolver_log); | 46 NetLog* net_log); |
45 | 47 |
46 // Used internally to handle PAC queries. | 48 // Used internally to handle PAC queries. |
47 // TODO(eroman): consider naming this simply "Request". | 49 // TODO(eroman): consider naming this simply "Request". |
48 class PacRequest; | 50 class PacRequest; |
49 | 51 |
50 // Returns ERR_IO_PENDING if the proxy information could not be provided | 52 // Returns ERR_IO_PENDING if the proxy information could not be provided |
51 // synchronously, to indicate that the result will be available when the | 53 // synchronously, to indicate that the result will be available when the |
52 // callback is run. The callback is run on the thread that calls | 54 // callback is run. The callback is run on the thread that calls |
53 // ResolveProxy. | 55 // ResolveProxy. |
54 // | 56 // |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 276 |
275 // Callback for when |init_proxy_resolver_| is done. | 277 // Callback for when |init_proxy_resolver_| is done. |
276 CompletionCallbackImpl<ProxyService> init_proxy_resolver_callback_; | 278 CompletionCallbackImpl<ProxyService> init_proxy_resolver_callback_; |
277 | 279 |
278 // Helper to download the PAC script (wpad + custom) and apply fallback rules. | 280 // Helper to download the PAC script (wpad + custom) and apply fallback rules. |
279 // | 281 // |
280 // Note that the declaration is important here: |proxy_script_fetcher_| and | 282 // Note that the declaration is important here: |proxy_script_fetcher_| and |
281 // |proxy_resolver_| must outlive |init_proxy_resolver_|. | 283 // |proxy_resolver_| must outlive |init_proxy_resolver_|. |
282 scoped_ptr<InitProxyResolver> init_proxy_resolver_; | 284 scoped_ptr<InitProxyResolver> init_proxy_resolver_; |
283 | 285 |
284 // Log for events generated by |init_proxy_resolver_|. | 286 // This is the log where any events generated by |init_proxy_resolver_| are |
285 BoundNetLog init_proxy_resolver_log_; | 287 // sent to. |
| 288 NetLog* net_log_; |
286 | 289 |
287 // The (possibly NULL) network change notifier that we use to decide when | 290 // The (possibly NULL) network change notifier that we use to decide when |
288 // to refetch PAC scripts or re-run WPAD. | 291 // to refetch PAC scripts or re-run WPAD. |
289 NetworkChangeNotifier* const network_change_notifier_; | 292 NetworkChangeNotifier* const network_change_notifier_; |
290 | 293 |
291 DISALLOW_COPY_AND_ASSIGN(ProxyService); | 294 DISALLOW_COPY_AND_ASSIGN(ProxyService); |
292 }; | 295 }; |
293 | 296 |
294 // Wrapper for invoking methods on a ProxyService synchronously. | 297 // Wrapper for invoking methods on a ProxyService synchronously. |
295 class SyncProxyServiceHelper | 298 class SyncProxyServiceHelper |
(...skipping 21 matching lines...) Expand all Loading... |
317 | 320 |
318 base::WaitableEvent event_; | 321 base::WaitableEvent event_; |
319 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; | 322 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; |
320 ProxyInfo proxy_info_; | 323 ProxyInfo proxy_info_; |
321 int result_; | 324 int result_; |
322 }; | 325 }; |
323 | 326 |
324 } // namespace net | 327 } // namespace net |
325 | 328 |
326 #endif // NET_PROXY_PROXY_SERVICE_H_ | 329 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |