droger | c690e880 | 2015-09-21 14:29:16 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/net/chrome_net_log_helper.h" |
| 6 | |
| 7 | #include "base/command_line.h" |
| 8 | #include "base/logging.h" |
| 9 | #include "chrome/common/chrome_switches.h" |
| 10 | |
| 11 | net::NetLogCaptureMode GetNetCaptureModeFromCommandLine( |
| 12 | const base::CommandLine& command_line) { |
| 13 | if (command_line.HasSwitch(switches::kNetLogCaptureMode)) { |
| 14 | std::string capture_mode_string = |
| 15 | command_line.GetSwitchValueASCII(switches::kNetLogCaptureMode); |
| 16 | if (capture_mode_string == "Default") |
| 17 | return net::NetLogCaptureMode::Default(); |
| 18 | if (capture_mode_string == "IncludeCookiesAndCredentials") |
| 19 | return net::NetLogCaptureMode::IncludeCookiesAndCredentials(); |
| 20 | if (capture_mode_string == "IncludeSocketBytes") |
| 21 | return net::NetLogCaptureMode::IncludeSocketBytes(); |
| 22 | |
| 23 | LOG(ERROR) << "Unrecognized value for --" << switches::kNetLogCaptureMode; |
| 24 | } |
| 25 | |
| 26 | return net::NetLogCaptureMode::Default(); |
| 27 | } |