| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/proxy/proxy_service.h" | 5 #include "net/proxy/proxy_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 base::TimeDelta::FromMilliseconds( | 386 base::TimeDelta::FromMilliseconds( |
| 387 kNumMillisToStallAfterNetworkChanges)) { | 387 kNumMillisToStallAfterNetworkChanges)) { |
| 388 NetworkChangeNotifier::AddIPAddressObserver(this); | 388 NetworkChangeNotifier::AddIPAddressObserver(this); |
| 389 ResetConfigService(config_service); | 389 ResetConfigService(config_service); |
| 390 } | 390 } |
| 391 | 391 |
| 392 // static | 392 // static |
| 393 ProxyService* ProxyService::CreateUsingV8ProxyResolver( | 393 ProxyService* ProxyService::CreateUsingV8ProxyResolver( |
| 394 ProxyConfigService* proxy_config_service, | 394 ProxyConfigService* proxy_config_service, |
| 395 size_t num_pac_threads, | 395 size_t num_pac_threads, |
| 396 ProxyScriptFetcher* proxy_script_fetcher, | 396 URLProxyScriptFetcher* proxy_script_fetcher, |
| 397 HostResolver* host_resolver, | 397 HostResolver* host_resolver, |
| 398 NetLog* net_log) { | 398 NetLog* net_log) { |
| 399 DCHECK(proxy_config_service); | 399 DCHECK(proxy_config_service); |
| 400 DCHECK(proxy_script_fetcher); | 400 DCHECK(proxy_script_fetcher); |
| 401 DCHECK(host_resolver); | 401 DCHECK(host_resolver); |
| 402 | 402 |
| 403 if (num_pac_threads == 0) | 403 if (num_pac_threads == 0) |
| 404 num_pac_threads = kDefaultNumPacThreads; | 404 num_pac_threads = kDefaultNumPacThreads; |
| 405 | 405 |
| 406 ProxyResolverFactory* sync_resolver_factory = | 406 ProxyResolverFactory* sync_resolver_factory = |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 // http://www.chromium.org/developers/design-documents/proxy-settings-fallba
ck | 732 // http://www.chromium.org/developers/design-documents/proxy-settings-fallba
ck |
| 733 result->UseDirect(); | 733 result->UseDirect(); |
| 734 result_code = OK; | 734 result_code = OK; |
| 735 } | 735 } |
| 736 | 736 |
| 737 net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE, NULL); | 737 net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE, NULL); |
| 738 return result_code; | 738 return result_code; |
| 739 } | 739 } |
| 740 | 740 |
| 741 void ProxyService::SetProxyScriptFetcher( | 741 void ProxyService::SetProxyScriptFetcher( |
| 742 ProxyScriptFetcher* proxy_script_fetcher) { | 742 URLProxyScriptFetcher* proxy_script_fetcher) { |
| 743 DCHECK(CalledOnValidThread()); | 743 DCHECK(CalledOnValidThread()); |
| 744 State previous_state = ResetProxyConfig(false); | 744 State previous_state = ResetProxyConfig(false); |
| 745 proxy_script_fetcher_.reset(proxy_script_fetcher); | 745 proxy_script_fetcher_.reset(proxy_script_fetcher); |
| 746 if (previous_state != STATE_NONE) | 746 if (previous_state != STATE_NONE) |
| 747 ApplyProxyConfigIfAvailable(); | 747 ApplyProxyConfigIfAvailable(); |
| 748 } | 748 } |
| 749 | 749 |
| 750 ProxyScriptFetcher* ProxyService::GetProxyScriptFetcher() const { | 750 URLProxyScriptFetcher* ProxyService::GetProxyScriptFetcher() const { |
| 751 DCHECK(CalledOnValidThread()); | 751 DCHECK(CalledOnValidThread()); |
| 752 return proxy_script_fetcher_.get(); | 752 return proxy_script_fetcher_.get(); |
| 753 } | 753 } |
| 754 | 754 |
| 755 ProxyService::State ProxyService::ResetProxyConfig(bool reset_fetched_config) { | 755 ProxyService::State ProxyService::ResetProxyConfig(bool reset_fetched_config) { |
| 756 DCHECK(CalledOnValidThread()); | 756 DCHECK(CalledOnValidThread()); |
| 757 State previous_state = current_state_; | 757 State previous_state = current_state_; |
| 758 | 758 |
| 759 proxy_retry_info_.clear(); | 759 proxy_retry_info_.clear(); |
| 760 init_proxy_resolver_.reset(); | 760 init_proxy_resolver_.reset(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 OnCompletion(result_); | 974 OnCompletion(result_); |
| 975 } | 975 } |
| 976 } | 976 } |
| 977 | 977 |
| 978 void SyncProxyServiceHelper::OnCompletion(int rv) { | 978 void SyncProxyServiceHelper::OnCompletion(int rv) { |
| 979 result_ = rv; | 979 result_ = rv; |
| 980 event_.Signal(); | 980 event_.Signal(); |
| 981 } | 981 } |
| 982 | 982 |
| 983 } // namespace net | 983 } // namespace net |
| OLD | NEW |