| Index: net/proxy/proxy_script_decider.cc
|
| diff --git a/net/proxy/proxy_script_decider.cc b/net/proxy/proxy_script_decider.cc
|
| index 939f7af1422a413fa5fd8a140b308d04e0843af6..e6c7af60f0c5028586e2f13eeea8b3c4a847c73d 100644
|
| --- a/net/proxy/proxy_script_decider.cc
|
| +++ b/net/proxy/proxy_script_decider.cc
|
| @@ -31,9 +31,8 @@ bool LooksLikePacScript(const base::string16& script) {
|
| //
|
| // An exact test would have to load the script in a javascript evaluator.
|
| return script.find(base::ASCIIToUTF16("FindProxyForURL")) !=
|
| - base::string16::npos;
|
| + base::string16::npos;
|
| }
|
| -
|
| }
|
|
|
| // This is the hard-coded location used by the DNS portion of web proxy
|
| @@ -85,15 +84,13 @@ ProxyScriptDecider::ProxyScriptDecider(
|
| current_pac_source_index_(0u),
|
| pac_mandatory_(false),
|
| next_state_(STATE_NONE),
|
| - net_log_(BoundNetLog::Make(
|
| - net_log, NetLog::SOURCE_PROXY_SCRIPT_DECIDER)),
|
| + net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_PROXY_SCRIPT_DECIDER)),
|
| fetch_pac_bytes_(false),
|
| quick_check_enabled_(true) {
|
| - if (proxy_script_fetcher &&
|
| - proxy_script_fetcher->GetRequestContext() &&
|
| + if (proxy_script_fetcher && proxy_script_fetcher->GetRequestContext() &&
|
| proxy_script_fetcher->GetRequestContext()->host_resolver()) {
|
| - host_resolver_.reset(new SingleRequestHostResolver(
|
| - proxy_script_fetcher->GetRequestContext()->host_resolver()));
|
| + host_resolver_.reset(new SingleRequestHostResolver(
|
| + proxy_script_fetcher->GetRequestContext()->host_resolver()));
|
| }
|
| }
|
|
|
| @@ -102,9 +99,10 @@ ProxyScriptDecider::~ProxyScriptDecider() {
|
| Cancel();
|
| }
|
|
|
| -int ProxyScriptDecider::Start(
|
| - const ProxyConfig& config, const base::TimeDelta wait_delay,
|
| - bool fetch_pac_bytes, const CompletionCallback& callback) {
|
| +int ProxyScriptDecider::Start(const ProxyConfig& config,
|
| + const base::TimeDelta wait_delay,
|
| + bool fetch_pac_bytes,
|
| + const CompletionCallback& callback) {
|
| DCHECK_EQ(STATE_NONE, next_state_);
|
| DCHECK(!callback.is_null());
|
| DCHECK(config.HasAutomaticSettings());
|
| @@ -150,8 +148,8 @@ ProxyResolverScriptData* ProxyScriptDecider::script_data() const {
|
| // (1) WPAD (DHCP).
|
| // (2) WPAD (DNS).
|
| // (3) Custom PAC URL.
|
| -ProxyScriptDecider::PacSourceList ProxyScriptDecider::
|
| - BuildPacSourcesFallbackList(
|
| +ProxyScriptDecider::PacSourceList
|
| +ProxyScriptDecider::BuildPacSourcesFallbackList(
|
| const ProxyConfig& config) const {
|
| PacSourceList pac_sources;
|
| if (config.auto_detect()) {
|
| @@ -230,8 +228,8 @@ int ProxyScriptDecider::DoWait() {
|
| return OK;
|
|
|
| // Otherwise wait the specified amount of time.
|
| - wait_timer_.Start(FROM_HERE, wait_delay_, this,
|
| - &ProxyScriptDecider::OnWaitTimerFired);
|
| + wait_timer_.Start(
|
| + FROM_HERE, wait_delay_, this, &ProxyScriptDecider::OnWaitTimerFired);
|
| net_log_.BeginEvent(NetLog::TYPE_PROXY_SCRIPT_DECIDER_WAIT);
|
| return ERR_IO_PENDING;
|
| }
|
| @@ -261,19 +259,18 @@ int ProxyScriptDecider::DoQuickCheck() {
|
| std::string host = current_pac_source().url.host();
|
| HostResolver::RequestInfo reqinfo(HostPortPair(host, 80));
|
| reqinfo.set_host_resolver_flags(HOST_RESOLVER_SYSTEM_ONLY);
|
| - CompletionCallback callback = base::Bind(
|
| - &ProxyScriptDecider::OnIOCompletion,
|
| - base::Unretained(this));
|
| + CompletionCallback callback =
|
| + base::Bind(&ProxyScriptDecider::OnIOCompletion, base::Unretained(this));
|
|
|
| next_state_ = STATE_QUICK_CHECK_COMPLETE;
|
| - quick_check_timer_.Start(FROM_HERE,
|
| - base::TimeDelta::FromMilliseconds(
|
| - kQuickCheckDelayMs),
|
| - base::Bind(callback, ERR_NAME_NOT_RESOLVED));
|
| + quick_check_timer_.Start(
|
| + FROM_HERE,
|
| + base::TimeDelta::FromMilliseconds(kQuickCheckDelayMs),
|
| + base::Bind(callback, ERR_NAME_NOT_RESOLVED));
|
|
|
| // We use HIGHEST here because proxy decision blocks doing any other requests.
|
| - return host_resolver_->Resolve(reqinfo, HIGHEST, &wpad_addresses_,
|
| - callback, net_log_);
|
| + return host_resolver_->Resolve(
|
| + reqinfo, HIGHEST, &wpad_addresses_, callback, net_log_);
|
| }
|
|
|
| int ProxyScriptDecider::DoQuickCheckComplete(int result) {
|
| @@ -313,8 +310,9 @@ int ProxyScriptDecider::DoFetchPacScript() {
|
| }
|
|
|
| return dhcp_proxy_script_fetcher_->Fetch(
|
| - &pac_script_, base::Bind(&ProxyScriptDecider::OnIOCompletion,
|
| - base::Unretained(this)));
|
| + &pac_script_,
|
| + base::Bind(&ProxyScriptDecider::OnIOCompletion,
|
| + base::Unretained(this)));
|
| }
|
|
|
| if (!proxy_script_fetcher_) {
|
| @@ -323,7 +321,8 @@ int ProxyScriptDecider::DoFetchPacScript() {
|
| }
|
|
|
| return proxy_script_fetcher_->Fetch(
|
| - effective_pac_url, &pac_script_,
|
| + effective_pac_url,
|
| + &pac_script_,
|
| base::Bind(&ProxyScriptDecider::OnIOCompletion, base::Unretained(this)));
|
| }
|
|
|
| @@ -359,9 +358,9 @@ int ProxyScriptDecider::DoVerifyPacScriptComplete(int result) {
|
| if (fetch_pac_bytes_) {
|
| script_data_ = ProxyResolverScriptData::FromUTF16(pac_script_);
|
| } else {
|
| - script_data_ = pac_source.type == PacSource::CUSTOM ?
|
| - ProxyResolverScriptData::FromURL(pac_source.url) :
|
| - ProxyResolverScriptData::ForAutoDetect();
|
| + script_data_ = pac_source.type == PacSource::CUSTOM
|
| + ? ProxyResolverScriptData::FromURL(pac_source.url)
|
| + : ProxyResolverScriptData::ForAutoDetect();
|
| }
|
|
|
| // Let the caller know which automatic setting we ended up initializing the
|
| @@ -422,7 +421,7 @@ int ProxyScriptDecider::TryToFallbackPacSource(int error) {
|
| }
|
|
|
| ProxyScriptDecider::State ProxyScriptDecider::GetStartState() const {
|
| - return fetch_pac_bytes_ ? STATE_FETCH_PAC_SCRIPT : STATE_VERIFY_PAC_SCRIPT;
|
| + return fetch_pac_bytes_ ? STATE_FETCH_PAC_SCRIPT : STATE_VERIFY_PAC_SCRIPT;
|
| }
|
|
|
| void ProxyScriptDecider::DetermineURL(const PacSource& pac_source,
|
| @@ -441,8 +440,8 @@ void ProxyScriptDecider::DetermineURL(const PacSource& pac_source,
|
| }
|
| }
|
|
|
| -const ProxyScriptDecider::PacSource&
|
| - ProxyScriptDecider::current_pac_source() const {
|
| +const ProxyScriptDecider::PacSource& ProxyScriptDecider::current_pac_source()
|
| + const {
|
| DCHECK_LT(current_pac_source_index_, pac_sources_.size());
|
| return pac_sources_[current_pac_source_index_];
|
| }
|
|
|