| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "headless/lib/browser/headless_browser_main_parts.h" | 5 #include "headless/lib/browser/headless_browser_main_parts.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
| 9 #include "headless/lib/browser/headless_browser_context_impl.h" | 9 #include "headless/lib/browser/headless_browser_context_impl.h" |
| 10 #include "headless/lib/browser/headless_browser_impl.h" | 10 #include "headless/lib/browser/headless_browser_impl.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 void HeadlessBrowserMainParts::PreMainMessageLoopRun() { | 23 void HeadlessBrowserMainParts::PreMainMessageLoopRun() { |
| 24 const base::CommandLine* command_line = | 24 const base::CommandLine* command_line = |
| 25 base::CommandLine::ForCurrentProcess(); | 25 base::CommandLine::ForCurrentProcess(); |
| 26 if (command_line->HasSwitch(switches::kLogNetLog)) { | 26 if (command_line->HasSwitch(switches::kLogNetLog)) { |
| 27 base::FilePath log_path = | 27 base::FilePath log_path = |
| 28 command_line->GetSwitchValuePath(switches::kLogNetLog); | 28 command_line->GetSwitchValuePath(switches::kLogNetLog); |
| 29 net_log_.reset(new HeadlessNetLog(log_path)); | 29 net_log_.reset(new HeadlessNetLog(log_path)); |
| 30 } | 30 } |
| 31 | 31 |
| 32 if (browser_->options()->devtools_endpoint.address().IsValid()) { | 32 if (browser_->options()->DevtoolsServerEnabled()) { |
| 33 StartLocalDevToolsHttpHandler(browser_->options()); | 33 StartLocalDevToolsHttpHandler(browser_->options()); |
| 34 devtools_http_handler_started_ = true; | 34 devtools_http_handler_started_ = true; |
| 35 } | 35 } |
| 36 browser_->PlatformInitialize(); | 36 browser_->PlatformInitialize(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void HeadlessBrowserMainParts::PostMainMessageLoopRun() { | 39 void HeadlessBrowserMainParts::PostMainMessageLoopRun() { |
| 40 if (devtools_http_handler_started_) { | 40 if (devtools_http_handler_started_) { |
| 41 StopLocalDevToolsHttpHandler(); | 41 StopLocalDevToolsHttpHandler(); |
| 42 devtools_http_handler_started_ = false; | 42 devtools_http_handler_started_ = false; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace headless | 46 } // namespace headless |
| OLD | NEW |