diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-28 01:17:56 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-28 01:17:56 +0000 |
commit | d747ef3e95dbcae4f31d6584c150cafd15e7feb4 (patch) | |
tree | 17fbfb8acbda36ea80e288aca2fea319e79075d4 /net/proxy/proxy_service.cc | |
parent | facefc587f0124781b9dd08f91ebe03019afb51e (diff) | |
download | chromium_src-d747ef3e95dbcae4f31d6584c150cafd15e7feb4.zip chromium_src-d747ef3e95dbcae4f31d6584c150cafd15e7feb4.tar.gz chromium_src-d747ef3e95dbcae4f31d6584c150cafd15e7feb4.tar.bz2 |
Display the "effective" proxy settings in about:net-internals.
The "effective" settings is what you get after applying the various fallbacks between automatic and manual settings.
This display makes it easier to notice whether "auto-detect" actually took effect, and if so what was the PAC URL it used.
BUG=53549
TEST=On windows change your proxy settings to include both auto-detect, a custom pac script, and some manually configured proxy servers. Now run chrome and go to the proxy tab on about:net-internals. Check that the "original" settings is what you entered in the dialog box, however the "effective" settings will only be a subset of them.
Review URL: http://codereview.chromium.org/3241002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57767 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_service.cc')
-rw-r--r-- | net/proxy/proxy_service.cc | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index e3fc422..9eedabb 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -369,7 +369,6 @@ ProxyService::ProxyService(ProxyConfigService* config_service, NetLog* net_log) : resolver_(resolver), next_config_id_(1), - should_use_proxy_resolver_(false), ALLOW_THIS_IN_INITIALIZER_LIST(init_proxy_resolver_callback_( this, &ProxyService::OnInitProxyResolverComplete)), current_state_(STATE_NONE) , @@ -504,11 +503,12 @@ int ProxyService::TryToCompleteSynchronously(const GURL& url, if (current_state_ != STATE_READY) return ERR_IO_PENDING; // Still initializing. - if (should_use_proxy_resolver_) + DCHECK_NE(config_.id(), ProxyConfig::INVALID_ID); + + if (config_.MayRequirePACResolver()) return ERR_IO_PENDING; // Must submit the request to the proxy resolver. // Use the manual proxy settings. - DCHECK(config_.id() != ProxyConfig::INVALID_ID); config_.proxy_rules().Apply(url, result); result->config_id_ = config_.id(); return OK; @@ -583,17 +583,18 @@ void ProxyService::ApplyProxyConfigIfAvailable() { void ProxyService::OnInitProxyResolverComplete(int result) { DCHECK_EQ(STATE_WAITING_FOR_INIT_PROXY_RESOLVER, current_state_); DCHECK(init_proxy_resolver_.get()); - DCHECK(config_.MayRequirePACResolver()); - DCHECK(!should_use_proxy_resolver_); + DCHECK(fetched_config_.MayRequirePACResolver()); init_proxy_resolver_.reset(); - should_use_proxy_resolver_ = result == OK; - if (result != OK) { LOG(INFO) << "Failed configuring with PAC script, falling-back to manual " "proxy servers."; + config_ = fetched_config_; + config_.ClearAutomaticSettings(); } + config_.set_id(fetched_config_.id()); + // Resume any requests which we had to defer until the PAC script was // downloaded. SetReady(); @@ -694,7 +695,6 @@ ProxyService::State ProxyService::ResetProxyConfig() { proxy_retry_info_.clear(); init_proxy_resolver_.reset(); - should_use_proxy_resolver_ = false; SuspendAllPendingRequests(); config_ = ProxyConfig(); current_state_ = STATE_NONE; @@ -767,17 +767,17 @@ ProxyConfigService* ProxyService::CreateSystemProxyConfigService( } void ProxyService::OnProxyConfigChanged(const ProxyConfig& config) { - ProxyConfig old_config = config_; + ProxyConfig old_fetched_config = fetched_config_; ResetProxyConfig(); // Increment the ID to reflect that the config has changed. - config_ = config; - config_.set_id(next_config_id_++); + fetched_config_ = config; + fetched_config_.set_id(next_config_id_++); // Emit the proxy settings change to the NetLog stream. if (net_log_) { scoped_refptr<NetLog::EventParameters> params = - new ProxyConfigChangedNetLogParam(old_config, config); + new ProxyConfigChangedNetLogParam(old_fetched_config, fetched_config_); net_log_->AddEntry(net::NetLog::TYPE_PROXY_CONFIG_CHANGED, base::TimeTicks::Now(), NetLog::Source(), @@ -785,7 +785,8 @@ void ProxyService::OnProxyConfigChanged(const ProxyConfig& config) { params); } - if (!config_.MayRequirePACResolver()) { + if (!fetched_config_.MayRequirePACResolver()) { + config_ = fetched_config_; SetReady(); return; } @@ -802,7 +803,7 @@ void ProxyService::OnProxyConfigChanged(const ProxyConfig& config) { stall_proxy_autoconfig_until_ - base::TimeTicks::Now(); int rv = init_proxy_resolver_->Init( - config_, wait_delay, &init_proxy_resolver_callback_); + fetched_config_, wait_delay, &config_, &init_proxy_resolver_callback_); if (rv != ERR_IO_PENDING) OnInitProxyResolverComplete(rv); |