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

Unified Diff: headless/public/headless_browser.h

Issue 2762593002: Add --headless flag to Windows (Closed)
Patch Set: readded headless_lib target Created 3 years, 9 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
Index: headless/public/headless_browser.h
diff --git a/headless/public/headless_browser.h b/headless/public/headless_browser.h
index 4b18f565b9e8fc2f2b8cb91ad0bb885a26a8a64e..064faa4b101d5eda907ad4963b75ead0319bea6c 100644
--- a/headless/public/headless_browser.h
+++ b/headless/public/headless_browser.h
@@ -22,6 +22,10 @@
#include "net/base/ip_endpoint.h"
#include "ui/gfx/geometry/size.h"
+#if defined(OS_WIN)
+#include "sandbox/win/src/sandbox_types.h"
+#endif
+
namespace base {
class MessagePump;
class SingleThreadTaskRunner;
@@ -89,7 +93,7 @@ class HEADLESS_EXPORT HeadlessBrowser {
};
// Embedding API overrides for the headless browser.
-struct HeadlessBrowser::Options {
+struct HEADLESS_EXPORT HeadlessBrowser::Options {
class Builder;
Options(Options&& options);
@@ -164,6 +168,14 @@ struct HeadlessBrowser::Options {
bool enable_crash_reporter;
base::FilePath crash_dumps_dir;
+#if defined(OS_WIN)
+ // Set hardware instance if available, otherwise it defaults to 0.
+ HINSTANCE instance;
Sami 2017/03/27 14:07:58 Looks like both of these are uninitialized.
dvallet 2017/03/28 02:36:00 They are set in HeadlessShellMain and headlessExam
Sami 2017/03/28 11:49:32 I meant Options::Options should set them to null l
dvallet 2017/03/29 06:27:56 Gotcha, Done.
+
+ // Set with sandboc information. This has to be already initialized.
+ sandbox::SandboxInterfaceInfo* sandbox_info;
+#endif
+
// Reminder: when adding a new field here, do not forget to add it to
// HeadlessBrowserContextOptions (where appropriate).
private:
@@ -172,7 +184,7 @@ struct HeadlessBrowser::Options {
DISALLOW_COPY_AND_ASSIGN(Options);
};
-class HeadlessBrowser::Options::Builder {
+class HEADLESS_EXPORT HeadlessBrowser::Options::Builder {
public:
Builder(int argc, const char** argv);
Builder();
@@ -186,6 +198,10 @@ class HeadlessBrowser::Options::Builder {
Builder& SetDisableSandbox(bool disable_sandbox);
Builder& SetGLImplementation(const std::string& gl_implementation);
Builder& AddMojoServiceName(const std::string& mojo_service_name);
+#if defined(OS_WIN)
+ Builder& SetInstance(HINSTANCE instance);
+ Builder& SetSandboxInfo(sandbox::SandboxInterfaceInfo* sandbox_info);
+#endif
// Per-context settings.
@@ -229,7 +245,9 @@ class HeadlessBrowser::Options::Builder {
//
// [1]
// https://chromium.googlesource.com/chromium/src/+/master/docs/linux_zygote.md
-void RunChildProcessIfNeeded(int argc, const char** argv);
+#if !defined(OS_WIN)
+HEADLESS_EXPORT void RunChildProcessIfNeeded(int argc, const char** argv);
+#endif
// Main entry point for running the headless browser. This function constructs
// the headless browser instance, passing it to the given
@@ -237,7 +255,7 @@ void RunChildProcessIfNeeded(int argc, const char** argv);
// the main loop, it will only return after HeadlessBrowser::Shutdown() is
// called, returning the exit code for the process. It is not possible to
// initialize the browser again after it has been torn down.
-int HeadlessBrowserMain(
+HEADLESS_EXPORT int HeadlessBrowserMain(
HeadlessBrowser::Options options,
const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback);

Powered by Google App Engine
This is Rietveld 408576698