Index: net/proxy/proxy_service.cc |
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc |
index c5cd6ac3354c6630f64426dd938a29d1a00e7ee3..d440f9001af5f7bf7ec56f4ed1416cd578f1f347 100644 |
--- a/net/proxy/proxy_service.cc |
+++ b/net/proxy/proxy_service.cc |
@@ -19,6 +19,7 @@ |
#include "base/thread_task_runner_handle.h" |
#include "base/values.h" |
#include "net/base/completion_callback.h" |
+#include "net/base/load_flags.h" |
#include "net/base/net_errors.h" |
#include "net/base/net_log.h" |
#include "net/base/net_util.h" |
@@ -771,7 +772,7 @@ class ProxyService::PacRequest |
} |
void StartAndCompleteCheckingForSynchronous() { |
- int rv = service_->TryToCompleteSynchronously(url_, results_); |
+ int rv = service_->TryToCompleteSynchronously(url_, 0, NULL, results_); |
if (rv == ERR_IO_PENDING) |
rv = Start(); |
if (rv != ERR_IO_PENDING) |
@@ -880,7 +881,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 +966,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,7 +992,8 @@ 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); |
@@ -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,12 @@ 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); |
bengr
2014/07/02 18:46:43
If you move this to DidFinishResolvingProxy, then
rcs
2014/07/02 22:53:13
Done.
|
+ |
return OK; |
} |
@@ -1166,10 +1178,12 @@ void ProxyService::OnInitProxyResolverComplete(int result) { |
} |
int ProxyService::ReconsiderProxyAfterError(const GURL& url, |
+ int load_flags, |
int net_error, |
ProxyInfo* result, |
const CompletionCallback& callback, |
PacRequest** pac_request, |
+ NetworkDelegate* network_delegate, |
const BoundNetLog& net_log) { |
DCHECK(CalledOnValidThread()); |
@@ -1183,7 +1197,8 @@ 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, load_flags, result, callback, pac_request, |
+ network_delegate, net_log); |
} |
#if defined(SPDY_PROXY_AUTH_ORIGIN) |
@@ -1623,7 +1638,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, net::LOAD_NORMAL, &proxy_info_, callback_, NULL, NULL, net_log); |
if (result_ != net::ERR_IO_PENDING) { |
OnCompletion(result_); |
} |
@@ -1633,7 +1648,8 @@ void SyncProxyServiceHelper::StartAsyncReconsider(const GURL& url, |
int net_error, |
const BoundNetLog& net_log) { |
result_ = proxy_service_->ReconsiderProxyAfterError( |
- url, net_error, &proxy_info_, callback_, NULL, net_log); |
+ url, net::LOAD_NORMAL, net_error, &proxy_info_, callback_, NULL, NULL, |
+ net_log); |
if (result_ != net::ERR_IO_PENDING) { |
OnCompletion(result_); |
} |