| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 private: | 299 private: |
| 300 const std::string pac_string_; | 300 const std::string pac_string_; |
| 301 | 301 |
| 302 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryForPacResult); | 302 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryForPacResult); |
| 303 }; | 303 }; |
| 304 | 304 |
| 305 // Returns NetLog parameters describing a proxy configuration change. | 305 // Returns NetLog parameters describing a proxy configuration change. |
| 306 base::Value* NetLogProxyConfigChangedCallback( | 306 base::Value* NetLogProxyConfigChangedCallback( |
| 307 const ProxyConfig* old_config, | 307 const ProxyConfig* old_config, |
| 308 const ProxyConfig* new_config, | 308 const ProxyConfig* new_config, |
| 309 NetLog::LogLevel /* log_level */) { | 309 NetLogCaptureMode /* capture_mode */) { |
| 310 base::DictionaryValue* dict = new base::DictionaryValue(); | 310 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 311 // The "old_config" is optional -- the first notification will not have | 311 // The "old_config" is optional -- the first notification will not have |
| 312 // any "previous" configuration. | 312 // any "previous" configuration. |
| 313 if (old_config->is_valid()) | 313 if (old_config->is_valid()) |
| 314 dict->Set("old_config", old_config->ToValue()); | 314 dict->Set("old_config", old_config->ToValue()); |
| 315 dict->Set("new_config", new_config->ToValue()); | 315 dict->Set("new_config", new_config->ToValue()); |
| 316 return dict; | 316 return dict; |
| 317 } | 317 } |
| 318 | 318 |
| 319 base::Value* NetLogBadProxyListCallback(const ProxyRetryInfoMap* retry_info, | 319 base::Value* NetLogBadProxyListCallback(const ProxyRetryInfoMap* retry_info, |
| 320 NetLog::LogLevel /* log_level */) { | 320 NetLogCaptureMode /* capture_mode */) { |
| 321 base::DictionaryValue* dict = new base::DictionaryValue(); | 321 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 322 base::ListValue* list = new base::ListValue(); | 322 base::ListValue* list = new base::ListValue(); |
| 323 | 323 |
| 324 for (ProxyRetryInfoMap::const_iterator iter = retry_info->begin(); | 324 for (ProxyRetryInfoMap::const_iterator iter = retry_info->begin(); |
| 325 iter != retry_info->end(); ++iter) { | 325 iter != retry_info->end(); ++iter) { |
| 326 list->Append(new base::StringValue(iter->first)); | 326 list->Append(new base::StringValue(iter->first)); |
| 327 } | 327 } |
| 328 dict->Set("bad_proxy_list", list); | 328 dict->Set("bad_proxy_list", list); |
| 329 return dict; | 329 return dict; |
| 330 } | 330 } |
| 331 | 331 |
| 332 // Returns NetLog parameters on a successfuly proxy resolution. | 332 // Returns NetLog parameters on a successfuly proxy resolution. |
| 333 base::Value* NetLogFinishedResolvingProxyCallback( | 333 base::Value* NetLogFinishedResolvingProxyCallback( |
| 334 const ProxyInfo* result, | 334 const ProxyInfo* result, |
| 335 NetLog::LogLevel /* log_level */) { | 335 NetLogCaptureMode /* capture_mode */) { |
| 336 base::DictionaryValue* dict = new base::DictionaryValue(); | 336 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 337 dict->SetString("pac_string", result->ToPacString()); | 337 dict->SetString("pac_string", result->ToPacString()); |
| 338 return dict; | 338 return dict; |
| 339 } | 339 } |
| 340 | 340 |
| 341 #if defined(OS_CHROMEOS) | 341 #if defined(OS_CHROMEOS) |
| 342 class UnsetProxyConfigService : public ProxyConfigService { | 342 class UnsetProxyConfigService : public ProxyConfigService { |
| 343 public: | 343 public: |
| 344 UnsetProxyConfigService() {} | 344 UnsetProxyConfigService() {} |
| 345 ~UnsetProxyConfigService() override {} | 345 ~UnsetProxyConfigService() override {} |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 int result_code, | 1394 int result_code, |
| 1395 const BoundNetLog& net_log) { | 1395 const BoundNetLog& net_log) { |
| 1396 // Log the result of the proxy resolution. | 1396 // Log the result of the proxy resolution. |
| 1397 if (result_code == OK) { | 1397 if (result_code == OK) { |
| 1398 // Allow the network delegate to interpose on the resolution decision, | 1398 // Allow the network delegate to interpose on the resolution decision, |
| 1399 // possibly modifying the ProxyInfo. | 1399 // possibly modifying the ProxyInfo. |
| 1400 if (network_delegate) | 1400 if (network_delegate) |
| 1401 network_delegate->NotifyResolveProxy(url, load_flags, *this, result); | 1401 network_delegate->NotifyResolveProxy(url, load_flags, *this, result); |
| 1402 | 1402 |
| 1403 // When logging all events is enabled, dump the proxy list. | 1403 // When logging all events is enabled, dump the proxy list. |
| 1404 if (net_log.IsLogging()) { | 1404 if (net_log.GetCaptureMode().enabled()) { |
| 1405 net_log.AddEvent( | 1405 net_log.AddEvent( |
| 1406 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, | 1406 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, |
| 1407 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); | 1407 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); |
| 1408 } | 1408 } |
| 1409 result->DeprioritizeBadProxies(proxy_retry_info_); | 1409 result->DeprioritizeBadProxies(proxy_retry_info_); |
| 1410 } else { | 1410 } else { |
| 1411 net_log.AddEventWithNetErrorCode( | 1411 net_log.AddEventWithNetErrorCode( |
| 1412 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code); | 1412 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code); |
| 1413 | 1413 |
| 1414 if (!config_.pac_mandatory()) { | 1414 if (!config_.pac_mandatory()) { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 State previous_state = ResetProxyConfig(false); | 1644 State previous_state = ResetProxyConfig(false); |
| 1645 if (previous_state != STATE_NONE) | 1645 if (previous_state != STATE_NONE) |
| 1646 ApplyProxyConfigIfAvailable(); | 1646 ApplyProxyConfigIfAvailable(); |
| 1647 } | 1647 } |
| 1648 | 1648 |
| 1649 void ProxyService::OnDNSChanged() { | 1649 void ProxyService::OnDNSChanged() { |
| 1650 OnIPAddressChanged(); | 1650 OnIPAddressChanged(); |
| 1651 } | 1651 } |
| 1652 | 1652 |
| 1653 } // namespace net | 1653 } // namespace net |
| OLD | NEW |