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

Side by Side Diff: headless/public/headless_browser.cc

Issue 2832963002: Reland of Add --headless flag to Windows (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « headless/public/headless_browser.h ('k') | headless/public/headless_shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/public/headless_browser.h" 5 #include "headless/public/headless_browser.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/public/common/user_agent.h" 9 #include "content/public/common/user_agent.h"
10 #include "headless/public/version.h" 10 #include "headless/public/version.h"
11 11
12 #if defined(OS_WIN)
13 #include "sandbox/win/src/sandbox_types.h"
14 #endif
15
12 using Options = headless::HeadlessBrowser::Options; 16 using Options = headless::HeadlessBrowser::Options;
13 using Builder = headless::HeadlessBrowser::Options::Builder; 17 using Builder = headless::HeadlessBrowser::Options::Builder;
14 18
15 namespace headless { 19 namespace headless {
16 20
17 namespace { 21 namespace {
18 // Product name for building the default user agent string. 22 // Product name for building the default user agent string.
19 const char kProductName[] = "HeadlessChrome"; 23 const char kProductName[] = "HeadlessChrome";
20 constexpr gfx::Size kDefaultWindowSize(800, 600); 24 constexpr gfx::Size kDefaultWindowSize(800, 600);
21 25
22 std::string GetProductNameAndVersion() { 26 std::string GetProductNameAndVersion() {
23 return std::string(kProductName) + "/" + PRODUCT_VERSION; 27 return std::string(kProductName) + "/" + PRODUCT_VERSION;
24 } 28 }
25 } // namespace 29 } // namespace
26 30
27 Options::Options(int argc, const char** argv) 31 Options::Options(int argc, const char** argv)
28 : argc(argc), 32 : argc(argc),
29 argv(argv), 33 argv(argv),
34 #if defined(OS_WIN)
35 instance(0),
36 sandbox_info(nullptr),
37 #endif
30 message_pump(nullptr), 38 message_pump(nullptr),
31 single_process_mode(false), 39 single_process_mode(false),
32 disable_sandbox(false), 40 disable_sandbox(false),
33 #if !defined(OS_MACOSX) 41 #if !defined(OS_MACOSX)
34 gl_implementation("osmesa"), 42 gl_implementation("osmesa"),
35 #else 43 #else
36 gl_implementation("any"), 44 gl_implementation("any"),
37 #endif 45 #endif
38 product_name_and_version(GetProductNameAndVersion()), 46 product_name_and_version(GetProductNameAndVersion()),
39 user_agent(content::BuildUserAgentFromProduct(product_name_and_version)), 47 user_agent(content::BuildUserAgentFromProduct(product_name_and_version)),
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 Builder& Builder::SetGLImplementation(const std::string& gl_implementation) { 106 Builder& Builder::SetGLImplementation(const std::string& gl_implementation) {
99 options_.gl_implementation = gl_implementation; 107 options_.gl_implementation = gl_implementation;
100 return *this; 108 return *this;
101 } 109 }
102 110
103 Builder& Builder::AddMojoServiceName(const std::string& mojo_service_name) { 111 Builder& Builder::AddMojoServiceName(const std::string& mojo_service_name) {
104 options_.mojo_service_names.insert(mojo_service_name); 112 options_.mojo_service_names.insert(mojo_service_name);
105 return *this; 113 return *this;
106 } 114 }
107 115
116 #if defined(OS_WIN)
117 Builder& Builder::SetInstance(HINSTANCE instance) {
118 options_.instance = instance;
119 return *this;
120 }
121
122 Builder& Builder::SetSandboxInfo(sandbox::SandboxInterfaceInfo* sandbox_info) {
123 options_.sandbox_info = sandbox_info;
124 return *this;
125 }
126 #endif // defined(OS_WIN)
127
108 Builder& Builder::SetUserDataDir(const base::FilePath& user_data_dir) { 128 Builder& Builder::SetUserDataDir(const base::FilePath& user_data_dir) {
109 options_.user_data_dir = user_data_dir; 129 options_.user_data_dir = user_data_dir;
110 return *this; 130 return *this;
111 } 131 }
112 132
113 Builder& Builder::SetWindowSize(const gfx::Size& window_size) { 133 Builder& Builder::SetWindowSize(const gfx::Size& window_size) {
114 options_.window_size = window_size; 134 options_.window_size = window_size;
115 return *this; 135 return *this;
116 } 136 }
117 137
(...skipping 16 matching lines...) Expand all
134 Builder& Builder::SetCrashDumpsDir(const base::FilePath& dir) { 154 Builder& Builder::SetCrashDumpsDir(const base::FilePath& dir) {
135 options_.crash_dumps_dir = dir; 155 options_.crash_dumps_dir = dir;
136 return *this; 156 return *this;
137 } 157 }
138 158
139 Options Builder::Build() { 159 Options Builder::Build() {
140 return std::move(options_); 160 return std::move(options_);
141 } 161 }
142 162
143 } // namespace headless 163 } // namespace headless
OLDNEW
« no previous file with comments | « headless/public/headless_browser.h ('k') | headless/public/headless_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698