Index: headless/lib/browser/headless_browser_main_parts.cc |
diff --git a/headless/lib/browser/headless_browser_main_parts.cc b/headless/lib/browser/headless_browser_main_parts.cc |
index 2ae52c3cc31eacb067aa583a6c8daf8d8ef6817f..6423a44113cbf75438d41e2e44fea22eb09aee35 100644 |
--- a/headless/lib/browser/headless_browser_main_parts.cc |
+++ b/headless/lib/browser/headless_browser_main_parts.cc |
@@ -4,9 +4,12 @@ |
#include "headless/lib/browser/headless_browser_main_parts.h" |
+#include "base/command_line.h" |
+#include "content/public/common/content_switches.h" |
#include "headless/lib/browser/headless_browser_context_impl.h" |
#include "headless/lib/browser/headless_browser_impl.h" |
#include "headless/lib/browser/headless_devtools.h" |
+#include "headless/lib/browser/headless_net_log.h" |
#include "headless/lib/browser/headless_screen.h" |
namespace headless { |
@@ -18,6 +21,14 @@ HeadlessBrowserMainParts::HeadlessBrowserMainParts(HeadlessBrowserImpl* browser) |
HeadlessBrowserMainParts::~HeadlessBrowserMainParts() {} |
void HeadlessBrowserMainParts::PreMainMessageLoopRun() { |
+ const base::CommandLine* command_line = |
+ base::CommandLine::ForCurrentProcess(); |
+ if (command_line->HasSwitch(switches::kLogNetLog)) { |
+ base::FilePath log_path = |
+ command_line->GetSwitchValuePath(switches::kLogNetLog); |
+ net_log_.reset(new HeadlessNetLog(log_path)); |
+ } |
+ |
if (browser_->options()->devtools_endpoint.address().IsValid()) { |
StartLocalDevToolsHttpHandler(browser_->options()); |
devtools_http_handler_started_ = true; |