| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // | 117 // |
| 118 // We use the three possible proxy access types in the following order, | 118 // We use the three possible proxy access types in the following order, |
| 119 // doing fallback if one doesn't work. See "pac_script_decider.h" | 119 // doing fallback if one doesn't work. See "pac_script_decider.h" |
| 120 // for the specifics. | 120 // for the specifics. |
| 121 // 1. WPAD auto-detection | 121 // 1. WPAD auto-detection |
| 122 // 2. PAC URL | 122 // 2. PAC URL |
| 123 // 3. named proxy | 123 // 3. named proxy |
| 124 // | 124 // |
| 125 // Profiling information for the request is saved to |net_log| if non-NULL. | 125 // Profiling information for the request is saved to |net_log| if non-NULL. |
| 126 int ResolveProxy(const GURL& url, | 126 int ResolveProxy(const GURL& url, |
| 127 int load_flags, |
| 127 ProxyInfo* results, | 128 ProxyInfo* results, |
| 128 const net::CompletionCallback& callback, | 129 const net::CompletionCallback& callback, |
| 129 PacRequest** pac_request, | 130 PacRequest** pac_request, |
| 131 NetworkDelegate* network_delegate, |
| 130 const BoundNetLog& net_log); | 132 const BoundNetLog& net_log); |
| 131 | 133 |
| 132 // This method is called after a failure to connect or resolve a host name. | 134 // This method is called after a failure to connect or resolve a host name. |
| 133 // It gives the proxy service an opportunity to reconsider the proxy to use. | 135 // It gives the proxy service an opportunity to reconsider the proxy to use. |
| 134 // The |results| parameter contains the results returned by an earlier call | 136 // The |results| parameter contains the results returned by an earlier call |
| 135 // to ResolveProxy. The |net_error| parameter contains the network error | 137 // to ResolveProxy. The |net_error| parameter contains the network error |
| 136 // code associated with the failure. See "net/base/net_error_list.h" for a | 138 // code associated with the failure. See "net/base/net_error_list.h" for a |
| 137 // list of possible values. The semantics of this call are otherwise | 139 // list of possible values. The semantics of this call are otherwise |
| 138 // similar to ResolveProxy. | 140 // similar to ResolveProxy. |
| 139 // | 141 // |
| 140 // NULL can be passed for |pac_request| if the caller will not need to | 142 // NULL can be passed for |pac_request| if the caller will not need to |
| 141 // cancel the request. | 143 // cancel the request. |
| 142 // | 144 // |
| 143 // Returns ERR_FAILED if there is not another proxy config to try. | 145 // Returns ERR_FAILED if there is not another proxy config to try. |
| 144 // | 146 // |
| 145 // Profiling information for the request is saved to |net_log| if non-NULL. | 147 // Profiling information for the request is saved to |net_log| if non-NULL. |
| 146 int ReconsiderProxyAfterError(const GURL& url, | 148 int ReconsiderProxyAfterError(const GURL& url, |
| 149 int load_flags, |
| 147 int net_error, | 150 int net_error, |
| 148 ProxyInfo* results, | 151 ProxyInfo* results, |
| 149 const CompletionCallback& callback, | 152 const CompletionCallback& callback, |
| 150 PacRequest** pac_request, | 153 PacRequest** pac_request, |
| 154 NetworkDelegate* network_delegate, |
| 151 const BoundNetLog& net_log); | 155 const BoundNetLog& net_log); |
| 152 | 156 |
| 153 // Explicitly trigger proxy fallback for the given |results| by updating our | 157 // Explicitly trigger proxy fallback for the given |results| by updating our |
| 154 // list of bad proxies to include the first entry of |results|, and, | 158 // list of bad proxies to include the first entry of |results|, and, |
| 155 // optionally, another bad proxy. Will retry after |retry_delay| if positive, | 159 // optionally, another bad proxy. Will retry after |retry_delay| if positive, |
| 156 // and will use the default proxy retry duration otherwise. Proxies marked as | 160 // and will use the default proxy retry duration otherwise. Proxies marked as |
| 157 // bad will not be retried until |retry_delay| has passed. Returns true if | 161 // bad will not be retried until |retry_delay| has passed. Returns true if |
| 158 // there will be at least one proxy remaining in the list after fallback and | 162 // there will be at least one proxy remaining in the list after fallback and |
| 159 // false otherwise. | 163 // false otherwise. |
| 160 bool MarkProxiesAsBadUntil(const ProxyInfo& results, | 164 bool MarkProxiesAsBadUntil(const ProxyInfo& results, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 // starts initializing for it. | 348 // starts initializing for it. |
| 345 void ApplyProxyConfigIfAvailable(); | 349 void ApplyProxyConfigIfAvailable(); |
| 346 | 350 |
| 347 // Callback for when the proxy resolver has been initialized with a | 351 // Callback for when the proxy resolver has been initialized with a |
| 348 // PAC script. | 352 // PAC script. |
| 349 void OnInitProxyResolverComplete(int result); | 353 void OnInitProxyResolverComplete(int result); |
| 350 | 354 |
| 351 // Returns ERR_IO_PENDING if the request cannot be completed synchronously. | 355 // Returns ERR_IO_PENDING if the request cannot be completed synchronously. |
| 352 // Otherwise it fills |result| with the proxy information for |url|. | 356 // Otherwise it fills |result| with the proxy information for |url|. |
| 353 // Completing synchronously means we don't need to query ProxyResolver. | 357 // Completing synchronously means we don't need to query ProxyResolver. |
| 354 int TryToCompleteSynchronously(const GURL& url, ProxyInfo* result); | 358 int TryToCompleteSynchronously(const GURL& url, int load_flags, |
| 359 NetworkDelegate* network_delegate, |
| 360 ProxyInfo* result); |
| 355 | 361 |
| 356 // Cancels all of the requests sent to the ProxyResolver. These will be | 362 // Cancels all of the requests sent to the ProxyResolver. These will be |
| 357 // restarted when calling SetReady(). | 363 // restarted when calling SetReady(). |
| 358 void SuspendAllPendingRequests(); | 364 void SuspendAllPendingRequests(); |
| 359 | 365 |
| 360 // Advances the current state to |STATE_READY|, and resumes any pending | 366 // Advances the current state to |STATE_READY|, and resumes any pending |
| 361 // requests which had been stalled waiting for initialization to complete. | 367 // requests which had been stalled waiting for initialization to complete. |
| 362 void SetReady(); | 368 void SetReady(); |
| 363 | 369 |
| 364 // Returns true if |pending_requests_| contains |req|. | 370 // Returns true if |pending_requests_| contains |req|. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 499 |
| 494 base::WaitableEvent event_; | 500 base::WaitableEvent event_; |
| 495 CompletionCallback callback_; | 501 CompletionCallback callback_; |
| 496 ProxyInfo proxy_info_; | 502 ProxyInfo proxy_info_; |
| 497 int result_; | 503 int result_; |
| 498 }; | 504 }; |
| 499 | 505 |
| 500 } // namespace net | 506 } // namespace net |
| 501 | 507 |
| 502 #endif // NET_PROXY_PROXY_SERVICE_H_ | 508 #endif // NET_PROXY_PROXY_SERVICE_H_ |
| OLD | NEW |