Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Unified Diff: headless/lib/browser/headless_browser_main_parts.cc

Issue 2841953002: headless: Add support for net logging (Closed)
Patch Set: CrOS build fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/lib/browser/headless_browser_main_parts.h ('k') | headless/lib/browser/headless_net_log.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « headless/lib/browser/headless_browser_main_parts.h ('k') | headless/lib/browser/headless_net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698