Index: net/proxy/proxy_service.cc |
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc |
index 1c9203348ae908a1bcf36862bf4fd443b85011cb..d12e12efa3734b2d654aaafd4e9c8d8f92e54aa5 100644 |
--- a/net/proxy/proxy_service.cc |
+++ b/net/proxy/proxy_service.cc |
@@ -164,6 +164,7 @@ class ProxyConfigServiceDirect : public ProxyConfigService { |
virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) |
OVERRIDE { |
*config = ProxyConfig::CreateDirect(); |
+ config->set_source(PROXY_CONFIG_SOURCE_NONE); |
return CONFIG_VALID; |
} |
}; |
@@ -799,6 +800,7 @@ class ProxyService::PacRequest |
url_(url), |
resolve_job_(NULL), |
config_id_(ProxyConfig::kInvalidConfigID), |
+ config_source_(PROXY_CONFIG_SOURCE_UNKNOWN), |
net_log_(net_log) { |
DCHECK(!user_callback.is_null()); |
} |
@@ -811,6 +813,7 @@ class ProxyService::PacRequest |
DCHECK(service_->config_.is_valid()); |
config_id_ = service_->config_.id(); |
+ config_source_ = service_->config_.source(); |
return resolver()->GetProxyForURL( |
url_, results_, |
@@ -866,10 +869,12 @@ class ProxyService::PacRequest |
// Make a note in the results which configuration was in use at the |
// time of the resolve. |
results_->config_id_ = config_id_; |
+ results_->config_source_ = config_source_; |
// Reset the state associated with in-progress-resolve. |
resolve_job_ = NULL; |
config_id_ = ProxyConfig::kInvalidConfigID; |
+ config_source_ = PROXY_CONFIG_SOURCE_UNKNOWN; |
return service_->DidFinishResolvingProxy(results_, result_code, net_log_); |
} |
@@ -911,6 +916,7 @@ class ProxyService::PacRequest |
GURL url_; |
ProxyResolver::RequestHandle resolve_job_; |
ProxyConfig::ID config_id_; // The config id when the resolve was started. |
+ ProxyConfigSource config_source_; // The source of proxy settings. |
BoundNetLog net_log_; |
}; |
@@ -1112,7 +1118,9 @@ int ProxyService::TryToCompleteSynchronously(const GURL& url, |
return ERR_IO_PENDING; // Must submit the request to the proxy resolver. |
// Use the manual proxy settings. |
- config_.proxy_rules().Apply(url, result); |
+ bool did_use_proxy_rules = config_.proxy_rules().Apply(url, result); |
+ result->config_source_ = |
+ (did_use_proxy_rules ? config_.source() : PROXY_CONFIG_SOURCE_NONE); |
eroman
2012/06/02 02:06:10
I still don't agree with this layering.
This make
|
result->config_id_ = config_.id(); |
return OK; |
} |
@@ -1234,6 +1242,7 @@ void ProxyService::OnInitProxyResolverComplete(int result) { |
// TODO(eroman): Make this ID unique in the case where configuration changed |
// due to ProxyScriptDeciderPoller. |
config_.set_id(fetched_config_.id()); |
+ config_.set_source(fetched_config_.source()); |
// Resume any requests which we had to defer until the PAC script was |
// downloaded. |