| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 NetLog* net_log) | 377 NetLog* net_log) |
| 378 : resolver_(resolver), | 378 : resolver_(resolver), |
| 379 next_config_id_(1), | 379 next_config_id_(1), |
| 380 ALLOW_THIS_IN_INITIALIZER_LIST(init_proxy_resolver_callback_( | 380 ALLOW_THIS_IN_INITIALIZER_LIST(init_proxy_resolver_callback_( |
| 381 this, &ProxyService::OnInitProxyResolverComplete)), | 381 this, &ProxyService::OnInitProxyResolverComplete)), |
| 382 current_state_(STATE_NONE) , | 382 current_state_(STATE_NONE) , |
| 383 net_log_(net_log), | 383 net_log_(net_log), |
| 384 stall_proxy_auto_config_delay_( | 384 stall_proxy_auto_config_delay_( |
| 385 base::TimeDelta::FromMilliseconds( | 385 base::TimeDelta::FromMilliseconds( |
| 386 kNumMillisToStallAfterNetworkChanges)) { | 386 kNumMillisToStallAfterNetworkChanges)) { |
| 387 NetworkChangeNotifier::AddObserver(this); | 387 NetworkChangeNotifier::AddIPAddressObserver(this); |
| 388 ResetConfigService(config_service); | 388 ResetConfigService(config_service); |
| 389 } | 389 } |
| 390 | 390 |
| 391 // static | 391 // static |
| 392 ProxyService* ProxyService::CreateUsingV8ProxyResolver( | 392 ProxyService* ProxyService::CreateUsingV8ProxyResolver( |
| 393 ProxyConfigService* proxy_config_service, | 393 ProxyConfigService* proxy_config_service, |
| 394 size_t num_pac_threads, | 394 size_t num_pac_threads, |
| 395 ProxyScriptFetcher* proxy_script_fetcher, | 395 ProxyScriptFetcher* proxy_script_fetcher, |
| 396 HostResolver* host_resolver, | 396 HostResolver* host_resolver, |
| 397 NetLog* net_log) { | 397 NetLog* net_log) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 if (config_.HasAutomaticSettings()) | 553 if (config_.HasAutomaticSettings()) |
| 554 return ERR_IO_PENDING; // Must submit the request to the proxy resolver. | 554 return ERR_IO_PENDING; // Must submit the request to the proxy resolver. |
| 555 | 555 |
| 556 // Use the manual proxy settings. | 556 // Use the manual proxy settings. |
| 557 config_.proxy_rules().Apply(url, result); | 557 config_.proxy_rules().Apply(url, result); |
| 558 result->config_id_ = config_.id(); | 558 result->config_id_ = config_.id(); |
| 559 return OK; | 559 return OK; |
| 560 } | 560 } |
| 561 | 561 |
| 562 ProxyService::~ProxyService() { | 562 ProxyService::~ProxyService() { |
| 563 NetworkChangeNotifier::RemoveObserver(this); | 563 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| 564 config_service_->RemoveObserver(this); | 564 config_service_->RemoveObserver(this); |
| 565 | 565 |
| 566 // Cancel any inprogress requests. | 566 // Cancel any inprogress requests. |
| 567 for (PendingRequests::iterator it = pending_requests_.begin(); | 567 for (PendingRequests::iterator it = pending_requests_.begin(); |
| 568 it != pending_requests_.end(); | 568 it != pending_requests_.end(); |
| 569 ++it) { | 569 ++it) { |
| 570 (*it)->Cancel(); | 570 (*it)->Cancel(); |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 | 573 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 OnCompletion(result_); | 943 OnCompletion(result_); |
| 944 } | 944 } |
| 945 } | 945 } |
| 946 | 946 |
| 947 void SyncProxyServiceHelper::OnCompletion(int rv) { | 947 void SyncProxyServiceHelper::OnCompletion(int rv) { |
| 948 result_ = rv; | 948 result_ = rv; |
| 949 event_.Signal(); | 949 event_.Signal(); |
| 950 } | 950 } |
| 951 | 951 |
| 952 } // namespace net | 952 } // namespace net |
| OLD | NEW |