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 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 int result_code, | 1377 int result_code, |
1378 const BoundNetLog& net_log) { | 1378 const BoundNetLog& net_log) { |
1379 // Log the result of the proxy resolution. | 1379 // Log the result of the proxy resolution. |
1380 if (result_code == OK) { | 1380 if (result_code == OK) { |
1381 // Allow the network delegate to interpose on the resolution decision, | 1381 // Allow the network delegate to interpose on the resolution decision, |
1382 // possibly modifying the ProxyInfo. | 1382 // possibly modifying the ProxyInfo. |
1383 if (network_delegate) | 1383 if (network_delegate) |
1384 network_delegate->NotifyResolveProxy(url, load_flags, *this, result); | 1384 network_delegate->NotifyResolveProxy(url, load_flags, *this, result); |
1385 | 1385 |
1386 // When logging all events is enabled, dump the proxy list. | 1386 // When logging all events is enabled, dump the proxy list. |
1387 if (net_log.IsLogging()) { | 1387 if (net_log.GetCaptureMode().enabled()) { |
1388 net_log.AddEvent( | 1388 net_log.AddEvent( |
1389 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, | 1389 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, |
1390 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); | 1390 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); |
1391 } | 1391 } |
1392 result->DeprioritizeBadProxies(proxy_retry_info_); | 1392 result->DeprioritizeBadProxies(proxy_retry_info_); |
1393 } else { | 1393 } else { |
1394 net_log.AddEventWithNetErrorCode( | 1394 net_log.AddEventWithNetErrorCode( |
1395 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code); | 1395 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code); |
1396 | 1396 |
1397 if (!config_.pac_mandatory()) { | 1397 if (!config_.pac_mandatory()) { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 State previous_state = ResetProxyConfig(false); | 1627 State previous_state = ResetProxyConfig(false); |
1628 if (previous_state != STATE_NONE) | 1628 if (previous_state != STATE_NONE) |
1629 ApplyProxyConfigIfAvailable(); | 1629 ApplyProxyConfigIfAvailable(); |
1630 } | 1630 } |
1631 | 1631 |
1632 void ProxyService::OnDNSChanged() { | 1632 void ProxyService::OnDNSChanged() { |
1633 OnIPAddressChanged(); | 1633 OnIPAddressChanged(); |
1634 } | 1634 } |
1635 | 1635 |
1636 } // namespace net | 1636 } // namespace net |
OLD | NEW |