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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // starts initializing for it. | 364 // starts initializing for it. |
361 void ApplyProxyConfigIfAvailable(); | 365 void ApplyProxyConfigIfAvailable(); |
362 | 366 |
363 // Callback for when the proxy resolver has been initialized with a | 367 // Callback for when the proxy resolver has been initialized with a |
364 // PAC script. | 368 // PAC script. |
365 void OnInitProxyResolverComplete(int result); | 369 void OnInitProxyResolverComplete(int result); |
366 | 370 |
367 // Returns ERR_IO_PENDING if the request cannot be completed synchronously. | 371 // Returns ERR_IO_PENDING if the request cannot be completed synchronously. |
368 // Otherwise it fills |result| with the proxy information for |url|. | 372 // Otherwise it fills |result| with the proxy information for |url|. |
369 // Completing synchronously means we don't need to query ProxyResolver. | 373 // Completing synchronously means we don't need to query ProxyResolver. |
370 int TryToCompleteSynchronously(const GURL& url, ProxyInfo* result); | 374 int TryToCompleteSynchronously(const GURL& url, |
| 375 int load_flags, |
| 376 NetworkDelegate* network_delegate, |
| 377 ProxyInfo* result); |
371 | 378 |
372 // Cancels all of the requests sent to the ProxyResolver. These will be | 379 // Cancels all of the requests sent to the ProxyResolver. These will be |
373 // restarted when calling SetReady(). | 380 // restarted when calling SetReady(). |
374 void SuspendAllPendingRequests(); | 381 void SuspendAllPendingRequests(); |
375 | 382 |
376 // Advances the current state to |STATE_READY|, and resumes any pending | 383 // Advances the current state to |STATE_READY|, and resumes any pending |
377 // requests which had been stalled waiting for initialization to complete. | 384 // requests which had been stalled waiting for initialization to complete. |
378 void SetReady(); | 385 void SetReady(); |
379 | 386 |
380 // Returns true if |pending_requests_| contains |req|. | 387 // Returns true if |pending_requests_| contains |req|. |
381 bool ContainsPendingRequest(PacRequest* req); | 388 bool ContainsPendingRequest(PacRequest* req); |
382 | 389 |
383 // Removes |req| from the list of pending requests. | 390 // Removes |req| from the list of pending requests. |
384 void RemovePendingRequest(PacRequest* req); | 391 void RemovePendingRequest(PacRequest* req); |
385 | 392 |
386 // Called when proxy resolution has completed (either synchronously or | 393 // Called when proxy resolution has completed (either synchronously or |
387 // asynchronously). Handles logging the result, and cleaning out | 394 // asynchronously). Handles logging the result, and cleaning out |
388 // bad entries from the results list. | 395 // bad entries from the results list. |
389 int DidFinishResolvingProxy(ProxyInfo* result, | 396 int DidFinishResolvingProxy(const GURL& url, |
| 397 int load_flags, |
| 398 NetworkDelegate* network_delegate, |
| 399 ProxyInfo* result, |
390 int result_code, | 400 int result_code, |
391 const BoundNetLog& net_log); | 401 const BoundNetLog& net_log); |
392 | 402 |
393 // Start initialization using |fetched_config_|. | 403 // Start initialization using |fetched_config_|. |
394 void InitializeUsingLastFetchedConfig(); | 404 void InitializeUsingLastFetchedConfig(); |
395 | 405 |
396 // Start the initialization skipping past the "decision" phase. | 406 // Start the initialization skipping past the "decision" phase. |
397 void InitializeUsingDecidedConfig( | 407 void InitializeUsingDecidedConfig( |
398 int decider_result, | 408 int decider_result, |
399 ProxyResolverScriptData* script_data, | 409 ProxyResolverScriptData* script_data, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 483 |
474 // Whether child ProxyScriptDeciders should use QuickCheck | 484 // Whether child ProxyScriptDeciders should use QuickCheck |
475 bool quick_check_enabled_; | 485 bool quick_check_enabled_; |
476 | 486 |
477 DISALLOW_COPY_AND_ASSIGN(ProxyService); | 487 DISALLOW_COPY_AND_ASSIGN(ProxyService); |
478 }; | 488 }; |
479 | 489 |
480 } // namespace net | 490 } // namespace net |
481 | 491 |
482 #endif // NET_PROXY_PROXY_SERVICE_H_ | 492 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |