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

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

Issue 2762593002: Add --headless flag to Windows (Closed)
Patch Set: added TODO Created 3 years, 7 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/DEPS ('k') | headless/lib/browser/headless_devtools_manager_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/headless_browser_impl.cc
diff --git a/headless/lib/browser/headless_browser_impl.cc b/headless/lib/browser/headless_browser_impl.cc
index c21bb2cafc747159bf0f2b299da43d9754b0cff1..f1a460ab3c4576ccba37830f11c087d0a370838c 100644
--- a/headless/lib/browser/headless_browser_impl.cc
+++ b/headless/lib/browser/headless_browser_impl.cc
@@ -29,11 +29,6 @@
#include "ui/events/devices/device_data_manager.h"
#include "ui/gfx/geometry/size.h"
-#if defined(OS_WIN)
-#include "content/public/app/sandbox_helper_win.h"
-#include "sandbox/win/src/sandbox_types.h"
-#endif
-
namespace content {
class DevToolsAgentHost;
}
@@ -46,9 +41,10 @@ int RunContentMain(
const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback) {
content::ContentMainParams params(nullptr);
#if defined(OS_WIN)
- sandbox::SandboxInterfaceInfo sandbox_info = {0};
- content::InitializeSandboxInfo(&sandbox_info);
- params.sandbox_info = &sandbox_info;
+ // Sandbox info has to be set and initialized.
+ CHECK(options.sandbox_info);
+ params.instance = options.instance;
+ params.sandbox_info = std::move(options.sandbox_info);
#elif !defined(OS_ANDROID)
params.argc = options.argc;
params.argv = options.argv;
@@ -237,15 +233,24 @@ bool HeadlessBrowserImpl::IsAttached() {
return agent_host_->IsAttached();
}
+#if defined(OS_WIN)
+void RunChildProcessIfNeeded(HINSTANCE instance,
+ sandbox::SandboxInterfaceInfo* sandbox_info) {
+ base::CommandLine::Init(0, nullptr);
+ HeadlessBrowser::Options::Builder builder(0, nullptr);
+ builder.SetInstance(instance);
+ builder.SetSandboxInfo(std::move(sandbox_info));
+#else
void RunChildProcessIfNeeded(int argc, const char** argv) {
base::CommandLine::Init(argc, argv);
+ HeadlessBrowser::Options::Builder builder(argc, argv);
+#endif // defined(OS_WIN)
const base::CommandLine& command_line(
*base::CommandLine::ForCurrentProcess());
if (!command_line.HasSwitch(::switches::kProcessType))
return;
- HeadlessBrowser::Options::Builder builder(argc, argv);
if (command_line.HasSwitch(switches::kUserAgent)) {
std::string ua = command_line.GetSwitchValueASCII(switches::kUserAgent);
if (net::HttpUtil::IsValidHeaderValue(ua))
« no previous file with comments | « headless/lib/browser/DEPS ('k') | headless/lib/browser/headless_devtools_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698