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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 // | 120 // |
121 // We use the three possible proxy access types in the following order, | 121 // We use the three possible proxy access types in the following order, |
122 // doing fallback if one doesn't work. See "pac_script_decider.h" | 122 // doing fallback if one doesn't work. See "pac_script_decider.h" |
123 // for the specifics. | 123 // for the specifics. |
124 // 1. WPAD auto-detection | 124 // 1. WPAD auto-detection |
125 // 2. PAC URL | 125 // 2. PAC URL |
126 // 3. named proxy | 126 // 3. named proxy |
127 // | 127 // |
128 // Profiling information for the request is saved to |net_log| if non-NULL. | 128 // Profiling information for the request is saved to |net_log| if non-NULL. |
129 int ResolveProxy(const GURL& url, | 129 int ResolveProxy(const GURL& url, |
130 const std::string& method, | |
bengr
2016/02/21 21:36:40
Add a description of |method| to the comment.
RyanSturm
2016/02/26 22:16:18
Done.
| |
130 int load_flags, | 131 int load_flags, |
131 ProxyInfo* results, | 132 ProxyInfo* results, |
132 const CompletionCallback& callback, | 133 const CompletionCallback& callback, |
133 PacRequest** pac_request, | 134 PacRequest** pac_request, |
134 ProxyDelegate* proxy_delegate, | 135 ProxyDelegate* proxy_delegate, |
135 const BoundNetLog& net_log); | 136 const BoundNetLog& net_log); |
136 | 137 |
137 // Returns true if the proxy information could be determined without spawning | 138 // Returns true if the proxy information could be determined without spawning |
138 // an asynchronous task. Otherwise, |result| is unmodified. | 139 // an asynchronous task. Otherwise, |result| is unmodified. |
139 bool TryResolveProxySynchronously(const GURL& raw_url, | 140 bool TryResolveProxySynchronously(const GURL& raw_url, |
141 const std::string& method, | |
140 int load_flags, | 142 int load_flags, |
141 ProxyInfo* result, | 143 ProxyInfo* result, |
142 ProxyDelegate* proxy_delegate, | 144 ProxyDelegate* proxy_delegate, |
143 const BoundNetLog& net_log); | 145 const BoundNetLog& net_log); |
144 | 146 |
145 // This method is called after a failure to connect or resolve a host name. | 147 // This method is called after a failure to connect or resolve a host name. |
146 // It gives the proxy service an opportunity to reconsider the proxy to use. | 148 // It gives the proxy service an opportunity to reconsider the proxy to use. |
147 // The |results| parameter contains the results returned by an earlier call | 149 // The |results| parameter contains the results returned by an earlier call |
148 // to ResolveProxy. The |net_error| parameter contains the network error | 150 // to ResolveProxy. The |net_error| parameter contains the network error |
149 // code associated with the failure. See "net/base/net_error_list.h" for a | 151 // code associated with the failure. See "net/base/net_error_list.h" for a |
150 // list of possible values. The semantics of this call are otherwise | 152 // list of possible values. The semantics of this call are otherwise |
151 // similar to ResolveProxy. | 153 // similar to ResolveProxy. |
152 // | 154 // |
153 // NULL can be passed for |pac_request| if the caller will not need to | 155 // NULL can be passed for |pac_request| if the caller will not need to |
154 // cancel the request. | 156 // cancel the request. |
155 // | 157 // |
156 // Returns ERR_FAILED if there is not another proxy config to try. | 158 // Returns ERR_FAILED if there is not another proxy config to try. |
157 // | 159 // |
158 // Profiling information for the request is saved to |net_log| if non-NULL. | 160 // Profiling information for the request is saved to |net_log| if non-NULL. |
159 int ReconsiderProxyAfterError(const GURL& url, | 161 int ReconsiderProxyAfterError(const GURL& url, |
162 const std::string& method, | |
160 int load_flags, | 163 int load_flags, |
161 int net_error, | 164 int net_error, |
162 ProxyInfo* results, | 165 ProxyInfo* results, |
163 const CompletionCallback& callback, | 166 const CompletionCallback& callback, |
164 PacRequest** pac_request, | 167 PacRequest** pac_request, |
165 ProxyDelegate* proxy_delegate, | 168 ProxyDelegate* proxy_delegate, |
166 const BoundNetLog& net_log); | 169 const BoundNetLog& net_log); |
167 | 170 |
168 // Explicitly trigger proxy fallback for the given |results| by updating our | 171 // Explicitly trigger proxy fallback for the given |results| by updating our |
169 // list of bad proxies to include the first entry of |results|, and, | 172 // list of bad proxies to include the first entry of |results|, and, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 // Completing synchronously means we don't need to query ProxyResolver. | 329 // Completing synchronously means we don't need to query ProxyResolver. |
327 int TryToCompleteSynchronously(const GURL& url, | 330 int TryToCompleteSynchronously(const GURL& url, |
328 int load_flags, | 331 int load_flags, |
329 ProxyDelegate* proxy_delegate, | 332 ProxyDelegate* proxy_delegate, |
330 ProxyInfo* result); | 333 ProxyInfo* result); |
331 | 334 |
332 // Identical to ResolveProxy, except that |callback| is permitted to be null. | 335 // Identical to ResolveProxy, except that |callback| is permitted to be null. |
333 // if |callback.is_null()|, this function becomes a thin wrapper around | 336 // if |callback.is_null()|, this function becomes a thin wrapper around |
334 // |TryToCompleteSynchronously|. | 337 // |TryToCompleteSynchronously|. |
335 int ResolveProxyHelper(const GURL& url, | 338 int ResolveProxyHelper(const GURL& url, |
339 const std::string& method, | |
336 int load_flags, | 340 int load_flags, |
337 ProxyInfo* results, | 341 ProxyInfo* results, |
338 const CompletionCallback& callback, | 342 const CompletionCallback& callback, |
339 PacRequest** pac_request, | 343 PacRequest** pac_request, |
340 ProxyDelegate* proxy_delegate, | 344 ProxyDelegate* proxy_delegate, |
341 const BoundNetLog& net_log); | 345 const BoundNetLog& net_log); |
342 | 346 |
343 // Cancels all of the requests sent to the ProxyResolver. These will be | 347 // Cancels all of the requests sent to the ProxyResolver. These will be |
344 // restarted when calling SetReady(). | 348 // restarted when calling SetReady(). |
345 void SuspendAllPendingRequests(); | 349 void SuspendAllPendingRequests(); |
346 | 350 |
347 // Advances the current state to |STATE_READY|, and resumes any pending | 351 // Advances the current state to |STATE_READY|, and resumes any pending |
348 // requests which had been stalled waiting for initialization to complete. | 352 // requests which had been stalled waiting for initialization to complete. |
349 void SetReady(); | 353 void SetReady(); |
350 | 354 |
351 // Returns true if |pending_requests_| contains |req|. | 355 // Returns true if |pending_requests_| contains |req|. |
352 bool ContainsPendingRequest(PacRequest* req); | 356 bool ContainsPendingRequest(PacRequest* req); |
353 | 357 |
354 // Removes |req| from the list of pending requests. | 358 // Removes |req| from the list of pending requests. |
355 void RemovePendingRequest(PacRequest* req); | 359 void RemovePendingRequest(PacRequest* req); |
356 | 360 |
357 // Called when proxy resolution has completed (either synchronously or | 361 // Called when proxy resolution has completed (either synchronously or |
358 // asynchronously). Handles logging the result, and cleaning out | 362 // asynchronously). Handles logging the result, and cleaning out |
359 // bad entries from the results list. | 363 // bad entries from the results list. |
360 int DidFinishResolvingProxy(const GURL& url, | 364 int DidFinishResolvingProxy(const GURL& url, |
365 const std::string& method, | |
361 int load_flags, | 366 int load_flags, |
362 ProxyDelegate* proxy_delegate, | 367 ProxyDelegate* proxy_delegate, |
363 ProxyInfo* result, | 368 ProxyInfo* result, |
364 int result_code, | 369 int result_code, |
365 const BoundNetLog& net_log, | 370 const BoundNetLog& net_log, |
366 base::TimeTicks start_time, | 371 base::TimeTicks start_time, |
367 bool script_executed); | 372 bool script_executed); |
368 | 373 |
369 // Start initialization using |fetched_config_|. | 374 // Start initialization using |fetched_config_|. |
370 void InitializeUsingLastFetchedConfig(); | 375 void InitializeUsingLastFetchedConfig(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 | 455 |
451 // Whether child ProxyScriptDeciders should use QuickCheck | 456 // Whether child ProxyScriptDeciders should use QuickCheck |
452 bool quick_check_enabled_; | 457 bool quick_check_enabled_; |
453 | 458 |
454 DISALLOW_COPY_AND_ASSIGN(ProxyService); | 459 DISALLOW_COPY_AND_ASSIGN(ProxyService); |
455 }; | 460 }; |
456 | 461 |
457 } // namespace net | 462 } // namespace net |
458 | 463 |
459 #endif // NET_PROXY_PROXY_SERVICE_H_ | 464 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |