Chromium Code Reviews| Index: net/proxy/proxy_service.cc |
| diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc |
| index c5cd6ac3354c6630f64426dd938a29d1a00e7ee3..e1046c1b6d25d47d4b96ef70e2fc460357358d9f 100644 |
| --- a/net/proxy/proxy_service.cc |
| +++ b/net/proxy/proxy_service.cc |
| @@ -771,7 +771,7 @@ class ProxyService::PacRequest |
| } |
| void StartAndCompleteCheckingForSynchronous() { |
| - int rv = service_->TryToCompleteSynchronously(url_, results_); |
| + int rv = service_->TryToCompleteSynchronously(url_, 0, NULL, results_); |
|
mmenke
2014/07/01 19:45:12
Rather than using 0 for load flags, should use LOA
rcs
2014/07/02 00:56:20
Done.
|
| if (rv == ERR_IO_PENDING) |
| rv = Start(); |
| if (rv != ERR_IO_PENDING) |
| @@ -880,7 +880,7 @@ ProxyService::ProxyService(ProxyConfigService* config_service, |
| NetLog* net_log) |
| : resolver_(resolver), |
| next_config_id_(1), |
| - current_state_(STATE_NONE) , |
| + current_state_(STATE_NONE), |
| net_log_(net_log), |
| stall_proxy_auto_config_delay_(TimeDelta::FromMilliseconds( |
| kDelayAfterNetworkChangesMs)), |
| @@ -965,9 +965,11 @@ ProxyService* ProxyService::CreateFixedFromPacResult( |
| } |
| int ProxyService::ResolveProxy(const GURL& raw_url, |
| + int load_flags, |
| ProxyInfo* result, |
| const net::CompletionCallback& callback, |
| PacRequest** pac_request, |
| + NetworkDelegate* network_delegate, |
| const BoundNetLog& net_log) { |
| DCHECK(CalledOnValidThread()); |
| DCHECK(!callback.is_null()); |
| @@ -989,10 +991,12 @@ int ProxyService::ResolveProxy(const GURL& raw_url, |
| // Check if the request can be completed right away. (This is the case when |
| // using a direct connection for example). |
| - int rv = TryToCompleteSynchronously(url, result); |
| + int rv = TryToCompleteSynchronously(url, load_flags, |
| + network_delegate, result); |
| if (rv != ERR_IO_PENDING) |
| return DidFinishResolvingProxy(result, rv, net_log); |
| + // TODO(rcs): add load_flags and network_delegate to PacRequest. |
|
mmenke
2014/07/01 19:45:12
Since we aren't using flywheel with PACs, and are
rcs
2014/07/02 00:56:20
Done.
|
| scoped_refptr<PacRequest> req( |
| new PacRequest(this, url, result, callback, net_log)); |
| @@ -1017,6 +1021,8 @@ int ProxyService::ResolveProxy(const GURL& raw_url, |
| } |
| int ProxyService::TryToCompleteSynchronously(const GURL& url, |
| + int load_flags, |
| + NetworkDelegate* network_delegate, |
| ProxyInfo* result) { |
| DCHECK_NE(STATE_NONE, current_state_); |
| @@ -1037,6 +1043,13 @@ int ProxyService::TryToCompleteSynchronously(const GURL& url, |
| config_.proxy_rules().Apply(url, result); |
| result->config_source_ = config_.source(); |
| result->config_id_ = config_.id(); |
| + |
| + // Allow the network delegate to interpose on the resolution decision, |
| + // possibly modifying the ProxyInfo. |
| + if (network_delegate) { |
| + network_delegate->NotifyResolveProxy(url, load_flags, result); |
| + } |
|
mmenke
2014/07/01 19:45:12
nit: To be consistent with the rest of the code i
rcs
2014/07/02 00:56:20
Done.
|
| + |
| return OK; |
| } |
| @@ -1183,7 +1196,7 @@ int ProxyService::ReconsiderProxyAfterError(const GURL& url, |
| // If we have a new config or the config was never tried, we delete the |
| // list of bad proxies and we try again. |
| proxy_retry_info_.clear(); |
| - return ResolveProxy(url, result, callback, pac_request, net_log); |
| + return ResolveProxy(url, 0, result, callback, pac_request, NULL, net_log); |
| } |
| #if defined(SPDY_PROXY_AUTH_ORIGIN) |
| @@ -1623,7 +1636,7 @@ SyncProxyServiceHelper::~SyncProxyServiceHelper() {} |
| void SyncProxyServiceHelper::StartAsyncResolve(const GURL& url, |
| const BoundNetLog& net_log) { |
| result_ = proxy_service_->ResolveProxy( |
| - url, &proxy_info_, callback_, NULL, net_log); |
| + url, 0, &proxy_info_, callback_, NULL, NULL, net_log); |
| if (result_ != net::ERR_IO_PENDING) { |
| OnCompletion(result_); |
| } |