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.
5 #include "chrome/browser/net/chrome_net_log_helper.h"
7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "chrome/common/chrome_switches.h"
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();
23 LOG(ERROR
) << "Unrecognized value for --" << switches::kNetLogCaptureMode
;
26 return net::NetLogCaptureMode::Default();