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, |
| 359 int load_flags, |
| 360 NetworkDelegate* network_delegate, |
| 361 ProxyInfo* result); |
355 | 362 |
356 // Cancels all of the requests sent to the ProxyResolver. These will be | 363 // Cancels all of the requests sent to the ProxyResolver. These will be |
357 // restarted when calling SetReady(). | 364 // restarted when calling SetReady(). |
358 void SuspendAllPendingRequests(); | 365 void SuspendAllPendingRequests(); |
359 | 366 |
360 // Advances the current state to |STATE_READY|, and resumes any pending | 367 // Advances the current state to |STATE_READY|, and resumes any pending |
361 // requests which had been stalled waiting for initialization to complete. | 368 // requests which had been stalled waiting for initialization to complete. |
362 void SetReady(); | 369 void SetReady(); |
363 | 370 |
364 // Returns true if |pending_requests_| contains |req|. | 371 // Returns true if |pending_requests_| contains |req|. |
365 bool ContainsPendingRequest(PacRequest* req); | 372 bool ContainsPendingRequest(PacRequest* req); |
366 | 373 |
367 // Removes |req| from the list of pending requests. | 374 // Removes |req| from the list of pending requests. |
368 void RemovePendingRequest(PacRequest* req); | 375 void RemovePendingRequest(PacRequest* req); |
369 | 376 |
370 // Called when proxy resolution has completed (either synchronously or | 377 // Called when proxy resolution has completed (either synchronously or |
371 // asynchronously). Handles logging the result, and cleaning out | 378 // asynchronously). Handles logging the result, and cleaning out |
372 // bad entries from the results list. | 379 // bad entries from the results list. |
373 int DidFinishResolvingProxy(ProxyInfo* result, | 380 int DidFinishResolvingProxy(const GURL& url, |
| 381 int load_flags, |
| 382 NetworkDelegate* network_delegate, |
| 383 ProxyInfo* result, |
374 int result_code, | 384 int result_code, |
375 const BoundNetLog& net_log); | 385 const BoundNetLog& net_log); |
376 | 386 |
377 // Start initialization using |fetched_config_|. | 387 // Start initialization using |fetched_config_|. |
378 void InitializeUsingLastFetchedConfig(); | 388 void InitializeUsingLastFetchedConfig(); |
379 | 389 |
380 // Start the initialization skipping past the "decision" phase. | 390 // Start the initialization skipping past the "decision" phase. |
381 void InitializeUsingDecidedConfig( | 391 void InitializeUsingDecidedConfig( |
382 int decider_result, | 392 int decider_result, |
383 ProxyResolverScriptData* script_data, | 393 ProxyResolverScriptData* script_data, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 | 503 |
494 base::WaitableEvent event_; | 504 base::WaitableEvent event_; |
495 CompletionCallback callback_; | 505 CompletionCallback callback_; |
496 ProxyInfo proxy_info_; | 506 ProxyInfo proxy_info_; |
497 int result_; | 507 int result_; |
498 }; | 508 }; |
499 | 509 |
500 } // namespace net | 510 } // namespace net |
501 | 511 |
502 #endif // NET_PROXY_PROXY_SERVICE_H_ | 512 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |