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 <stdio.h> | 5 #include <stdio.h> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 if (parsed && timeout_seconds > 0) { | 289 if (parsed && timeout_seconds > 0) { |
290 config_timeout_ = base::TimeDelta::FromSeconds(timeout_seconds); | 290 config_timeout_ = base::TimeDelta::FromSeconds(timeout_seconds); |
291 } else { | 291 } else { |
292 fprintf(stderr, "Invalid config_timeout parameter\n"); | 292 fprintf(stderr, "Invalid config_timeout parameter\n"); |
293 return false; | 293 return false; |
294 } | 294 } |
295 } | 295 } |
296 | 296 |
297 if (parsed_command_line.HasSwitch("net_log")) { | 297 if (parsed_command_line.HasSwitch("net_log")) { |
298 std::string log_param = parsed_command_line.GetSwitchValueASCII("net_log"); | 298 std::string log_param = parsed_command_line.GetSwitchValueASCII("net_log"); |
299 NetLog::LogLevel level = NetLog::LOG_ALL_BUT_BYTES; | 299 NetLogCaptureMode capture_mode = |
| 300 NetLogCaptureMode::IncludeCookiesAndCredentials(); |
300 | 301 |
301 if (log_param.length() > 0) { | 302 if (log_param.length() > 0) { |
302 std::map<std::string, NetLog::LogLevel> log_levels; | 303 std::map<std::string, NetLogCaptureMode> capture_modes; |
303 log_levels["all"] = NetLog::LOG_ALL; | 304 capture_modes["all"] = NetLogCaptureMode::IncludeSocketBytes(); |
304 log_levels["no_bytes"] = NetLog::LOG_ALL_BUT_BYTES; | 305 capture_modes["no_bytes"] = |
| 306 NetLogCaptureMode::IncludeCookiesAndCredentials(); |
305 | 307 |
306 if (log_levels.find(log_param) != log_levels.end()) { | 308 if (capture_modes.find(log_param) != capture_modes.end()) { |
307 level = log_levels[log_param]; | 309 capture_mode = capture_modes[log_param]; |
308 } else { | 310 } else { |
309 fprintf(stderr, "Invalid net_log parameter\n"); | 311 fprintf(stderr, "Invalid net_log parameter\n"); |
310 return false; | 312 return false; |
311 } | 313 } |
312 } | 314 } |
313 log_.reset(new NetLog); | 315 log_.reset(new NetLog); |
314 log_observer_.reset(new FileNetLogObserver(stderr)); | 316 log_observer_.reset(new FileNetLogObserver(stderr)); |
315 log_->DeprecatedAddObserver(log_observer_.get(), level); | 317 log_->DeprecatedAddObserver(log_observer_.get(), capture_mode); |
316 } | 318 } |
317 | 319 |
318 print_config_ = parsed_command_line.HasSwitch("print_config"); | 320 print_config_ = parsed_command_line.HasSwitch("print_config"); |
319 print_hosts_ = parsed_command_line.HasSwitch("print_hosts"); | 321 print_hosts_ = parsed_command_line.HasSwitch("print_hosts"); |
320 | 322 |
321 if (parsed_command_line.HasSwitch("nameserver")) { | 323 if (parsed_command_line.HasSwitch("nameserver")) { |
322 std::string nameserver = | 324 std::string nameserver = |
323 parsed_command_line.GetSwitchValueASCII("nameserver"); | 325 parsed_command_line.GetSwitchValueASCII("nameserver"); |
324 if (!StringToIPEndPoint(nameserver, &nameserver_)) { | 326 if (!StringToIPEndPoint(nameserver, &nameserver_)) { |
325 fprintf(stderr, | 327 fprintf(stderr, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 } | 510 } |
509 | 511 |
510 } // empty namespace | 512 } // empty namespace |
511 | 513 |
512 } // namespace net | 514 } // namespace net |
513 | 515 |
514 int main(int argc, const char* argv[]) { | 516 int main(int argc, const char* argv[]) { |
515 net::GDig dig; | 517 net::GDig dig; |
516 return dig.Main(argc, argv); | 518 return dig.Main(argc, argv); |
517 } | 519 } |
OLD | NEW |