| 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 // Strip away any reference fragments and the username/password, as they | 505 // Strip away any reference fragments and the username/password, as they |
| 506 // are not relevant to proxy resolution. | 506 // are not relevant to proxy resolution. |
| 507 GURL url = SimplifyUrlForRequest(raw_url); | 507 GURL url = SimplifyUrlForRequest(raw_url); |
| 508 | 508 |
| 509 // Check if the request can be completed right away. (This is the case when | 509 // Check if the request can be completed right away. (This is the case when |
| 510 // using a direct connection for example). | 510 // using a direct connection for example). |
| 511 int rv = TryToCompleteSynchronously(url, result); | 511 int rv = TryToCompleteSynchronously(url, result); |
| 512 if (rv != ERR_IO_PENDING) | 512 if (rv != ERR_IO_PENDING) |
| 513 return DidFinishResolvingProxy(result, rv, net_log); | 513 return DidFinishResolvingProxy(result, rv, net_log); |
| 514 | 514 |
| 515 scoped_refptr<PacRequest> req = | 515 scoped_refptr<PacRequest> req( |
| 516 new PacRequest(this, url, result, callback, net_log); | 516 new PacRequest(this, url, result, callback, net_log)); |
| 517 | 517 |
| 518 if (current_state_ == STATE_READY) { | 518 if (current_state_ == STATE_READY) { |
| 519 // Start the resolve request. | 519 // Start the resolve request. |
| 520 rv = req->Start(); | 520 rv = req->Start(); |
| 521 if (rv != ERR_IO_PENDING) | 521 if (rv != ERR_IO_PENDING) |
| 522 return req->QueryDidComplete(rv); | 522 return req->QueryDidComplete(rv); |
| 523 } else { | 523 } else { |
| 524 req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC, | 524 req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC, |
| 525 NULL); | 525 NULL); |
| 526 } | 526 } |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 #else | 811 #else |
| 812 LOG(WARNING) << "Failed to choose a system proxy settings fetcher " | 812 LOG(WARNING) << "Failed to choose a system proxy settings fetcher " |
| 813 "for this platform."; | 813 "for this platform."; |
| 814 return new ProxyConfigServiceNull(); | 814 return new ProxyConfigServiceNull(); |
| 815 #endif | 815 #endif |
| 816 } | 816 } |
| 817 | 817 |
| 818 void ProxyService::OnProxyConfigChanged(const ProxyConfig& config) { | 818 void ProxyService::OnProxyConfigChanged(const ProxyConfig& config) { |
| 819 // Emit the proxy settings change to the NetLog stream. | 819 // Emit the proxy settings change to the NetLog stream. |
| 820 if (net_log_) { | 820 if (net_log_) { |
| 821 scoped_refptr<NetLog::EventParameters> params = | 821 scoped_refptr<NetLog::EventParameters> params( |
| 822 new ProxyConfigChangedNetLogParam(fetched_config_, config); | 822 new ProxyConfigChangedNetLogParam(fetched_config_, config)); |
| 823 net_log_->AddEntry(net::NetLog::TYPE_PROXY_CONFIG_CHANGED, | 823 net_log_->AddEntry(net::NetLog::TYPE_PROXY_CONFIG_CHANGED, |
| 824 base::TimeTicks::Now(), | 824 base::TimeTicks::Now(), |
| 825 NetLog::Source(), | 825 NetLog::Source(), |
| 826 NetLog::PHASE_NONE, | 826 NetLog::PHASE_NONE, |
| 827 params); | 827 params); |
| 828 } | 828 } |
| 829 | 829 |
| 830 // Set the new configuration as the most recently fetched one. | 830 // Set the new configuration as the most recently fetched one. |
| 831 fetched_config_ = config; | 831 fetched_config_ = config; |
| 832 fetched_config_.set_id(1); // Needed for a later DCHECK of is_valid(). | 832 fetched_config_.set_id(1); // Needed for a later DCHECK of is_valid(). |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 OnCompletion(result_); | 936 OnCompletion(result_); |
| 937 } | 937 } |
| 938 } | 938 } |
| 939 | 939 |
| 940 void SyncProxyServiceHelper::OnCompletion(int rv) { | 940 void SyncProxyServiceHelper::OnCompletion(int rv) { |
| 941 result_ = rv; | 941 result_ = rv; |
| 942 event_.Signal(); | 942 event_.Signal(); |
| 943 } | 943 } |
| 944 | 944 |
| 945 } // namespace net | 945 } // namespace net |
| OLD | NEW |