| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // to ResolveProxy. The semantics of this call are otherwise similar to | 135 // to ResolveProxy. The semantics of this call are otherwise similar to |
| 136 // ResolveProxy. | 136 // ResolveProxy. |
| 137 // | 137 // |
| 138 // NULL can be passed for |pac_request| if the caller will not need to | 138 // NULL can be passed for |pac_request| if the caller will not need to |
| 139 // cancel the request. | 139 // cancel the request. |
| 140 // | 140 // |
| 141 // Returns ERR_FAILED if there is not another proxy config to try. | 141 // Returns ERR_FAILED if there is not another proxy config to try. |
| 142 // | 142 // |
| 143 // Profiling information for the request is saved to |net_log| if non-NULL. | 143 // Profiling information for the request is saved to |net_log| if non-NULL. |
| 144 int ReconsiderProxyAfterError(const GURL& url, | 144 int ReconsiderProxyAfterError(const GURL& url, |
| 145 int net_error, |
| 145 ProxyInfo* results, | 146 ProxyInfo* results, |
| 146 const CompletionCallback& callback, | 147 const CompletionCallback& callback, |
| 147 PacRequest** pac_request, | 148 PacRequest** pac_request, |
| 148 const BoundNetLog& net_log); | 149 const BoundNetLog& net_log); |
| 149 | 150 |
| 150 // Explicitly trigger proxy fallback for the given |results| by updating our | 151 // Explicitly trigger proxy fallback for the given |results| by updating our |
| 151 // list of bad proxies to include the first entry of |results|, and, | 152 // list of bad proxies to include the first entry of |results|, and, |
| 152 // optionally, another bad proxy. Will retry after |retry_delay| if positive, | 153 // optionally, another bad proxy. Will retry after |retry_delay| if positive, |
| 153 // and will use the default proxy retry duration otherwise. Proxies marked as | 154 // and will use the default proxy retry duration otherwise. Proxies marked as |
| 154 // bad will not be retried until |retry_delay| has passed. Returns true if | 155 // bad will not be retried until |retry_delay| has passed. Returns true if |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 280 |
| 280 // Bypass the proxy because of an internal server error. | 281 // Bypass the proxy because of an internal server error. |
| 281 INTERNAL_SERVER_ERROR_BYPASS, | 282 INTERNAL_SERVER_ERROR_BYPASS, |
| 282 | 283 |
| 283 // Bypass the proxy because of any other error. | 284 // Bypass the proxy because of any other error. |
| 284 ERROR_BYPASS, | 285 ERROR_BYPASS, |
| 285 | 286 |
| 286 // Bypass the proxy because responses appear not to be coming via it. | 287 // Bypass the proxy because responses appear not to be coming via it. |
| 287 MISSING_VIA_HEADER, | 288 MISSING_VIA_HEADER, |
| 288 | 289 |
| 290 // Bypass the proxy because the proxy, not the origin, sent a 4xx response. |
| 291 PROXY_4XX_BYPASS, |
| 292 |
| 289 // This must always be last. | 293 // This must always be last. |
| 290 BYPASS_EVENT_TYPE_MAX | 294 BYPASS_EVENT_TYPE_MAX |
| 291 }; | 295 }; |
| 292 | 296 |
| 293 // Records a |DataReductionProxyBypassEventType| for either the data reduction | 297 // Records a |DataReductionProxyBypassEventType| for either the data reduction |
| 294 // proxy (|is_primary| is true) or the data reduction proxy fallback. | 298 // proxy (|is_primary| is true) or the data reduction proxy fallback. |
| 295 void RecordDataReductionProxyBypassInfo( | 299 void RecordDataReductionProxyBypassInfo( |
| 296 bool is_primary, | 300 bool is_primary, |
| 297 const ProxyServer& proxy_server, | 301 const ProxyServer& proxy_server, |
| 298 DataReductionProxyBypassEventType bypass_type) const; | 302 DataReductionProxyBypassEventType bypass_type) const; |
| 303 |
| 304 // Records a net error code that resulted in bypassing the data reduction |
| 305 // proxy (|is_primary| is true) or the data reduction proxy fallback. |
| 306 void RecordDataReductionProxyBypassOnNetworkError( |
| 307 bool is_primary, |
| 308 const ProxyServer& proxy_server, |
| 309 int net_error); |
| 299 #endif | 310 #endif |
| 300 | 311 |
| 301 private: | 312 private: |
| 302 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); | 313 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); |
| 303 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect); | 314 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect); |
| 304 friend class PacRequest; | 315 friend class PacRequest; |
| 305 class InitProxyResolver; | 316 class InitProxyResolver; |
| 306 class ProxyScriptDeciderPoller; | 317 class ProxyScriptDeciderPoller; |
| 307 | 318 |
| 308 // TODO(eroman): change this to a std::set. Note that this requires updating | 319 // TODO(eroman): change this to a std::set. Note that this requires updating |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 class NET_EXPORT SyncProxyServiceHelper | 462 class NET_EXPORT SyncProxyServiceHelper |
| 452 : public base::RefCountedThreadSafe<SyncProxyServiceHelper> { | 463 : public base::RefCountedThreadSafe<SyncProxyServiceHelper> { |
| 453 public: | 464 public: |
| 454 SyncProxyServiceHelper(base::MessageLoop* io_message_loop, | 465 SyncProxyServiceHelper(base::MessageLoop* io_message_loop, |
| 455 ProxyService* proxy_service); | 466 ProxyService* proxy_service); |
| 456 | 467 |
| 457 int ResolveProxy(const GURL& url, | 468 int ResolveProxy(const GURL& url, |
| 458 ProxyInfo* proxy_info, | 469 ProxyInfo* proxy_info, |
| 459 const BoundNetLog& net_log); | 470 const BoundNetLog& net_log); |
| 460 int ReconsiderProxyAfterError(const GURL& url, | 471 int ReconsiderProxyAfterError(const GURL& url, |
| 472 int net_error, |
| 461 ProxyInfo* proxy_info, | 473 ProxyInfo* proxy_info, |
| 462 const BoundNetLog& net_log); | 474 const BoundNetLog& net_log); |
| 463 | 475 |
| 464 private: | 476 private: |
| 465 friend class base::RefCountedThreadSafe<SyncProxyServiceHelper>; | 477 friend class base::RefCountedThreadSafe<SyncProxyServiceHelper>; |
| 466 | 478 |
| 467 virtual ~SyncProxyServiceHelper(); | 479 virtual ~SyncProxyServiceHelper(); |
| 468 | 480 |
| 469 void StartAsyncResolve(const GURL& url, const BoundNetLog& net_log); | 481 void StartAsyncResolve(const GURL& url, const BoundNetLog& net_log); |
| 470 void StartAsyncReconsider(const GURL& url, const BoundNetLog& net_log); | 482 void StartAsyncReconsider(const GURL& url, |
| 483 int net_error, |
| 484 const BoundNetLog& net_log); |
| 471 | 485 |
| 472 void OnCompletion(int result); | 486 void OnCompletion(int result); |
| 473 | 487 |
| 474 base::MessageLoop* io_message_loop_; | 488 base::MessageLoop* io_message_loop_; |
| 475 ProxyService* proxy_service_; | 489 ProxyService* proxy_service_; |
| 476 | 490 |
| 477 base::WaitableEvent event_; | 491 base::WaitableEvent event_; |
| 478 CompletionCallback callback_; | 492 CompletionCallback callback_; |
| 479 ProxyInfo proxy_info_; | 493 ProxyInfo proxy_info_; |
| 480 int result_; | 494 int result_; |
| 481 }; | 495 }; |
| 482 | 496 |
| 483 } // namespace net | 497 } // namespace net |
| 484 | 498 |
| 485 #endif // NET_PROXY_PROXY_SERVICE_H_ | 499 #endif // NET_PROXY_PROXY_SERVICE_H_ |
| OLD | NEW |