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/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) | 12 #if defined(OS_WIN) |
13 #include "sandbox/win/src/sandbox_types.h" | 13 #include "sandbox/win/src/sandbox_types.h" |
14 #endif | 14 #endif |
15 | 15 |
16 using Options = headless::HeadlessBrowser::Options; | 16 using Options = headless::HeadlessBrowser::Options; |
17 using Builder = headless::HeadlessBrowser::Options::Builder; | 17 using Builder = headless::HeadlessBrowser::Options::Builder; |
18 | 18 |
19 namespace headless { | 19 namespace headless { |
20 | 20 |
21 namespace { | 21 namespace { |
22 // Product name for building the default user agent string. | 22 // Product name for building the default user agent string. |
23 const char kProductName[] = "HeadlessChrome"; | 23 const char kProductName[] = "HeadlessChrome"; |
24 constexpr gfx::Size kDefaultWindowSize(800, 600); | 24 constexpr gfx::Size kDefaultWindowSize(800, 600); |
| 25 constexpr gfx::Size kDefaultScreenSize(1920, 1080); |
25 | 26 |
26 std::string GetProductNameAndVersion() { | 27 std::string GetProductNameAndVersion() { |
27 return std::string(kProductName) + "/" + PRODUCT_VERSION; | 28 return std::string(kProductName) + "/" + PRODUCT_VERSION; |
28 } | 29 } |
29 } // namespace | 30 } // namespace |
30 | 31 |
31 Options::Options(int argc, const char** argv) | 32 Options::Options(int argc, const char** argv) |
32 : argc(argc), | 33 : argc(argc), |
33 argv(argv), | 34 argv(argv), |
34 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
35 instance(0), | 36 instance(0), |
36 sandbox_info(nullptr), | 37 sandbox_info(nullptr), |
37 #endif | 38 #endif |
38 devtools_socket_fd(0), | 39 devtools_socket_fd(0), |
39 message_pump(nullptr), | 40 message_pump(nullptr), |
40 single_process_mode(false), | 41 single_process_mode(false), |
41 disable_sandbox(false), | 42 disable_sandbox(false), |
42 #if !defined(OS_MACOSX) | 43 #if !defined(OS_MACOSX) |
43 gl_implementation("osmesa"), | 44 gl_implementation("osmesa"), |
44 #else | 45 #else |
45 gl_implementation("any"), | 46 gl_implementation("any"), |
46 #endif | 47 #endif |
47 product_name_and_version(GetProductNameAndVersion()), | 48 product_name_and_version(GetProductNameAndVersion()), |
48 user_agent(content::BuildUserAgentFromProduct(product_name_and_version)), | 49 user_agent(content::BuildUserAgentFromProduct(product_name_and_version)), |
49 window_size(kDefaultWindowSize), | 50 window_size(kDefaultWindowSize), |
| 51 screen_size(kDefaultScreenSize), |
50 incognito_mode(true), | 52 incognito_mode(true), |
51 enable_crash_reporter(false) { | 53 enable_crash_reporter(false) { |
52 } | 54 } |
53 | 55 |
54 Options::Options(Options&& options) = default; | 56 Options::Options(Options&& options) = default; |
55 | 57 |
56 Options::~Options() {} | 58 Options::~Options() {} |
57 | 59 |
58 Options& Options::operator=(Options&& options) = default; | 60 Options& Options::operator=(Options&& options) = default; |
59 | 61 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 Builder& Builder::SetCrashDumpsDir(const base::FilePath& dir) { | 166 Builder& Builder::SetCrashDumpsDir(const base::FilePath& dir) { |
165 options_.crash_dumps_dir = dir; | 167 options_.crash_dumps_dir = dir; |
166 return *this; | 168 return *this; |
167 } | 169 } |
168 | 170 |
169 Options Builder::Build() { | 171 Options Builder::Build() { |
170 return std::move(options_); | 172 return std::move(options_); |
171 } | 173 } |
172 | 174 |
173 } // namespace headless | 175 } // namespace headless |
OLD | NEW |