OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 int load_flags, | 1290 int load_flags, |
1291 NetworkDelegate* network_delegate, | 1291 NetworkDelegate* network_delegate, |
1292 ProxyInfo* result, | 1292 ProxyInfo* result, |
1293 int result_code, | 1293 int result_code, |
1294 const BoundNetLog& net_log) { | 1294 const BoundNetLog& net_log) { |
1295 // Log the result of the proxy resolution. | 1295 // Log the result of the proxy resolution. |
1296 if (result_code == OK) { | 1296 if (result_code == OK) { |
1297 // Allow the network delegate to interpose on the resolution decision, | 1297 // Allow the network delegate to interpose on the resolution decision, |
1298 // possibly modifying the ProxyInfo. | 1298 // possibly modifying the ProxyInfo. |
1299 if (network_delegate) | 1299 if (network_delegate) |
1300 network_delegate->NotifyResolveProxy(url, load_flags, result); | 1300 network_delegate->NotifyResolveProxy(url, load_flags, *this, result); |
1301 | 1301 |
1302 // When logging all events is enabled, dump the proxy list. | 1302 // When logging all events is enabled, dump the proxy list. |
1303 if (net_log.IsLogging()) { | 1303 if (net_log.IsLogging()) { |
1304 net_log.AddEvent( | 1304 net_log.AddEvent( |
1305 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, | 1305 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, |
1306 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); | 1306 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); |
1307 } | 1307 } |
1308 result->DeprioritizeBadProxies(proxy_retry_info_); | 1308 result->DeprioritizeBadProxies(proxy_retry_info_); |
1309 } else { | 1309 } else { |
1310 net_log.AddEventWithNetErrorCode( | 1310 net_log.AddEventWithNetErrorCode( |
1311 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code); | 1311 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code); |
1312 | 1312 |
1313 if (!config_.pac_mandatory()) { | 1313 if (!config_.pac_mandatory()) { |
1314 // Fall-back to direct when the proxy resolver fails. This corresponds | 1314 // Fall-back to direct when the proxy resolver fails. This corresponds |
1315 // with a javascript runtime error in the PAC script. | 1315 // with a javascript runtime error in the PAC script. |
1316 // | 1316 // |
1317 // This implicit fall-back to direct matches Firefox 3.5 and | 1317 // This implicit fall-back to direct matches Firefox 3.5 and |
1318 // Internet Explorer 8. For more information, see: | 1318 // Internet Explorer 8. For more information, see: |
1319 // | 1319 // |
1320 // http://www.chromium.org/developers/design-documents/proxy-settings-fall
back | 1320 // http://www.chromium.org/developers/design-documents/proxy-settings-fall
back |
1321 result->UseDirect(); | 1321 result->UseDirect(); |
1322 result_code = OK; | 1322 result_code = OK; |
1323 | 1323 |
1324 // Allow the network delegate to interpose on the resolution decision, | 1324 // Allow the network delegate to interpose on the resolution decision, |
1325 // possibly modifying the ProxyInfo. | 1325 // possibly modifying the ProxyInfo. |
1326 if (network_delegate) | 1326 if (network_delegate) |
1327 network_delegate->NotifyResolveProxy(url, load_flags, result); | 1327 network_delegate->NotifyResolveProxy(url, load_flags, *this, result); |
1328 } else { | 1328 } else { |
1329 result_code = ERR_MANDATORY_PROXY_CONFIGURATION_FAILED; | 1329 result_code = ERR_MANDATORY_PROXY_CONFIGURATION_FAILED; |
1330 } | 1330 } |
1331 } | 1331 } |
1332 | 1332 |
1333 net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE); | 1333 net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE); |
1334 return result_code; | 1334 return result_code; |
1335 } | 1335 } |
1336 | 1336 |
1337 void ProxyService::SetProxyScriptFetchers( | 1337 void ProxyService::SetProxyScriptFetchers( |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 State previous_state = ResetProxyConfig(false); | 1555 State previous_state = ResetProxyConfig(false); |
1556 if (previous_state != STATE_NONE) | 1556 if (previous_state != STATE_NONE) |
1557 ApplyProxyConfigIfAvailable(); | 1557 ApplyProxyConfigIfAvailable(); |
1558 } | 1558 } |
1559 | 1559 |
1560 void ProxyService::OnDNSChanged() { | 1560 void ProxyService::OnDNSChanged() { |
1561 OnIPAddressChanged(); | 1561 OnIPAddressChanged(); |
1562 } | 1562 } |
1563 | 1563 |
1564 } // namespace net | 1564 } // namespace net |
OLD | NEW |