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_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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // | 123 // |
124 // Profiling information for the request is saved to |net_log| if non-NULL. | 124 // Profiling information for the request is saved to |net_log| if non-NULL. |
125 int ResolveProxy(const GURL& url, | 125 int ResolveProxy(const GURL& url, |
126 int load_flags, | 126 int load_flags, |
127 ProxyInfo* results, | 127 ProxyInfo* results, |
128 const net::CompletionCallback& callback, | 128 const net::CompletionCallback& callback, |
129 PacRequest** pac_request, | 129 PacRequest** pac_request, |
130 NetworkDelegate* network_delegate, | 130 NetworkDelegate* network_delegate, |
131 const BoundNetLog& net_log); | 131 const BoundNetLog& net_log); |
132 | 132 |
| 133 // Returns true if the proxy information could be determined without spawning |
| 134 // an asynchronous task. Otherwise, |result| is unmodified. |
| 135 bool TryResolveProxySynchronously(const GURL& raw_url, |
| 136 int load_flags, |
| 137 ProxyInfo* result, |
| 138 NetworkDelegate* network_delegate, |
| 139 const BoundNetLog& net_log); |
| 140 |
133 // This method is called after a failure to connect or resolve a host name. | 141 // This method is called after a failure to connect or resolve a host name. |
134 // It gives the proxy service an opportunity to reconsider the proxy to use. | 142 // It gives the proxy service an opportunity to reconsider the proxy to use. |
135 // The |results| parameter contains the results returned by an earlier call | 143 // The |results| parameter contains the results returned by an earlier call |
136 // to ResolveProxy. The |net_error| parameter contains the network error | 144 // to ResolveProxy. The |net_error| parameter contains the network error |
137 // code associated with the failure. See "net/base/net_error_list.h" for a | 145 // code associated with the failure. See "net/base/net_error_list.h" for a |
138 // list of possible values. The semantics of this call are otherwise | 146 // list of possible values. The semantics of this call are otherwise |
139 // similar to ResolveProxy. | 147 // similar to ResolveProxy. |
140 // | 148 // |
141 // NULL can be passed for |pac_request| if the caller will not need to | 149 // NULL can be passed for |pac_request| if the caller will not need to |
142 // cancel the request. | 150 // cancel the request. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 void OnInitProxyResolverComplete(int result); | 322 void OnInitProxyResolverComplete(int result); |
315 | 323 |
316 // Returns ERR_IO_PENDING if the request cannot be completed synchronously. | 324 // Returns ERR_IO_PENDING if the request cannot be completed synchronously. |
317 // Otherwise it fills |result| with the proxy information for |url|. | 325 // Otherwise it fills |result| with the proxy information for |url|. |
318 // Completing synchronously means we don't need to query ProxyResolver. | 326 // Completing synchronously means we don't need to query ProxyResolver. |
319 int TryToCompleteSynchronously(const GURL& url, | 327 int TryToCompleteSynchronously(const GURL& url, |
320 int load_flags, | 328 int load_flags, |
321 NetworkDelegate* network_delegate, | 329 NetworkDelegate* network_delegate, |
322 ProxyInfo* result); | 330 ProxyInfo* result); |
323 | 331 |
| 332 // Identical to ResolveProxy, except that |callback| is permitted to be null. |
| 333 // if |callback.is_null()|, this function becomes a thin wrapper around |
| 334 // |TryToCompleteSynchronously|. |
| 335 int ResolveProxyHelper(const GURL& url, |
| 336 int load_flags, |
| 337 ProxyInfo* results, |
| 338 const net::CompletionCallback& callback, |
| 339 PacRequest** pac_request, |
| 340 NetworkDelegate* network_delegate, |
| 341 const BoundNetLog& net_log); |
| 342 |
324 // Cancels all of the requests sent to the ProxyResolver. These will be | 343 // Cancels all of the requests sent to the ProxyResolver. These will be |
325 // restarted when calling SetReady(). | 344 // restarted when calling SetReady(). |
326 void SuspendAllPendingRequests(); | 345 void SuspendAllPendingRequests(); |
327 | 346 |
328 // Advances the current state to |STATE_READY|, and resumes any pending | 347 // Advances the current state to |STATE_READY|, and resumes any pending |
329 // requests which had been stalled waiting for initialization to complete. | 348 // requests which had been stalled waiting for initialization to complete. |
330 void SetReady(); | 349 void SetReady(); |
331 | 350 |
332 // Returns true if |pending_requests_| contains |req|. | 351 // Returns true if |pending_requests_| contains |req|. |
333 bool ContainsPendingRequest(PacRequest* req); | 352 bool ContainsPendingRequest(PacRequest* req); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 447 |
429 // Whether child ProxyScriptDeciders should use QuickCheck | 448 // Whether child ProxyScriptDeciders should use QuickCheck |
430 bool quick_check_enabled_; | 449 bool quick_check_enabled_; |
431 | 450 |
432 DISALLOW_COPY_AND_ASSIGN(ProxyService); | 451 DISALLOW_COPY_AND_ASSIGN(ProxyService); |
433 }; | 452 }; |
434 | 453 |
435 } // namespace net | 454 } // namespace net |
436 | 455 |
437 #endif // NET_PROXY_PROXY_SERVICE_H_ | 456 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |