blob: bd63d69c0a649dd08602c8739cb44c0f8cfe7d2e [file] [log] [blame]
drogerc690e8802015-09-21 14:29:161// 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
11net::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}