Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: net/proxy/proxy_service.cc

Issue 1059843002: Refactor NetLog::LogLevel --> NetLogCaptureMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again to fix a merge conflict Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/proxy/proxy_script_decider.cc ('k') | net/quic/quic_client_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 private: 309 private:
310 const std::string pac_string_; 310 const std::string pac_string_;
311 311
312 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryForPacResult); 312 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryForPacResult);
313 }; 313 };
314 314
315 // Returns NetLog parameters describing a proxy configuration change. 315 // Returns NetLog parameters describing a proxy configuration change.
316 base::Value* NetLogProxyConfigChangedCallback( 316 base::Value* NetLogProxyConfigChangedCallback(
317 const ProxyConfig* old_config, 317 const ProxyConfig* old_config,
318 const ProxyConfig* new_config, 318 const ProxyConfig* new_config,
319 NetLog::LogLevel /* log_level */) { 319 NetLogCaptureMode /* capture_mode */) {
320 base::DictionaryValue* dict = new base::DictionaryValue(); 320 base::DictionaryValue* dict = new base::DictionaryValue();
321 // The "old_config" is optional -- the first notification will not have 321 // The "old_config" is optional -- the first notification will not have
322 // any "previous" configuration. 322 // any "previous" configuration.
323 if (old_config->is_valid()) 323 if (old_config->is_valid())
324 dict->Set("old_config", old_config->ToValue()); 324 dict->Set("old_config", old_config->ToValue());
325 dict->Set("new_config", new_config->ToValue()); 325 dict->Set("new_config", new_config->ToValue());
326 return dict; 326 return dict;
327 } 327 }
328 328
329 base::Value* NetLogBadProxyListCallback(const ProxyRetryInfoMap* retry_info, 329 base::Value* NetLogBadProxyListCallback(const ProxyRetryInfoMap* retry_info,
330 NetLog::LogLevel /* log_level */) { 330 NetLogCaptureMode /* capture_mode */) {
331 base::DictionaryValue* dict = new base::DictionaryValue(); 331 base::DictionaryValue* dict = new base::DictionaryValue();
332 base::ListValue* list = new base::ListValue(); 332 base::ListValue* list = new base::ListValue();
333 333
334 for (ProxyRetryInfoMap::const_iterator iter = retry_info->begin(); 334 for (ProxyRetryInfoMap::const_iterator iter = retry_info->begin();
335 iter != retry_info->end(); ++iter) { 335 iter != retry_info->end(); ++iter) {
336 list->Append(new base::StringValue(iter->first)); 336 list->Append(new base::StringValue(iter->first));
337 } 337 }
338 dict->Set("bad_proxy_list", list); 338 dict->Set("bad_proxy_list", list);
339 return dict; 339 return dict;
340 } 340 }
341 341
342 // Returns NetLog parameters on a successfuly proxy resolution. 342 // Returns NetLog parameters on a successfuly proxy resolution.
343 base::Value* NetLogFinishedResolvingProxyCallback( 343 base::Value* NetLogFinishedResolvingProxyCallback(
344 const ProxyInfo* result, 344 const ProxyInfo* result,
345 NetLog::LogLevel /* log_level */) { 345 NetLogCaptureMode /* capture_mode */) {
346 base::DictionaryValue* dict = new base::DictionaryValue(); 346 base::DictionaryValue* dict = new base::DictionaryValue();
347 dict->SetString("pac_string", result->ToPacString()); 347 dict->SetString("pac_string", result->ToPacString());
348 return dict; 348 return dict;
349 } 349 }
350 350
351 #if defined(OS_CHROMEOS) 351 #if defined(OS_CHROMEOS)
352 class UnsetProxyConfigService : public ProxyConfigService { 352 class UnsetProxyConfigService : public ProxyConfigService {
353 public: 353 public:
354 UnsetProxyConfigService() {} 354 UnsetProxyConfigService() {}
355 ~UnsetProxyConfigService() override {} 355 ~UnsetProxyConfigService() override {}
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 int result_code, 1382 int result_code,
1383 const BoundNetLog& net_log) { 1383 const BoundNetLog& net_log) {
1384 // Log the result of the proxy resolution. 1384 // Log the result of the proxy resolution.
1385 if (result_code == OK) { 1385 if (result_code == OK) {
1386 // Allow the network delegate to interpose on the resolution decision, 1386 // Allow the network delegate to interpose on the resolution decision,
1387 // possibly modifying the ProxyInfo. 1387 // possibly modifying the ProxyInfo.
1388 if (network_delegate) 1388 if (network_delegate)
1389 network_delegate->NotifyResolveProxy(url, load_flags, *this, result); 1389 network_delegate->NotifyResolveProxy(url, load_flags, *this, result);
1390 1390
1391 // When logging all events is enabled, dump the proxy list. 1391 // When logging all events is enabled, dump the proxy list.
1392 if (net_log.IsLogging()) { 1392 if (net_log.GetCaptureMode().enabled()) {
1393 net_log.AddEvent( 1393 net_log.AddEvent(
1394 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, 1394 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST,
1395 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); 1395 base::Bind(&NetLogFinishedResolvingProxyCallback, result));
1396 } 1396 }
1397 result->DeprioritizeBadProxies(proxy_retry_info_); 1397 result->DeprioritizeBadProxies(proxy_retry_info_);
1398 } else { 1398 } else {
1399 net_log.AddEventWithNetErrorCode( 1399 net_log.AddEventWithNetErrorCode(
1400 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code); 1400 NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code);
1401 1401
1402 if (!config_.pac_mandatory()) { 1402 if (!config_.pac_mandatory()) {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 State previous_state = ResetProxyConfig(false); 1632 State previous_state = ResetProxyConfig(false);
1633 if (previous_state != STATE_NONE) 1633 if (previous_state != STATE_NONE)
1634 ApplyProxyConfigIfAvailable(); 1634 ApplyProxyConfigIfAvailable();
1635 } 1635 }
1636 1636
1637 void ProxyService::OnDNSChanged() { 1637 void ProxyService::OnDNSChanged() {
1638 OnIPAddressChanged(); 1638 OnIPAddressChanged();
1639 } 1639 }
1640 1640
1641 } // namespace net 1641 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_script_decider.cc ('k') | net/quic/quic_client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698