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) |
| 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 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 Builder& Builder::SetGLImplementation(const std::string& gl_implementation) { | 97 Builder& Builder::SetGLImplementation(const std::string& gl_implementation) { |
94 options_.gl_implementation = gl_implementation; | 98 options_.gl_implementation = gl_implementation; |
95 return *this; | 99 return *this; |
96 } | 100 } |
97 | 101 |
98 Builder& Builder::AddMojoServiceName(const std::string& mojo_service_name) { | 102 Builder& Builder::AddMojoServiceName(const std::string& mojo_service_name) { |
99 options_.mojo_service_names.insert(mojo_service_name); | 103 options_.mojo_service_names.insert(mojo_service_name); |
100 return *this; | 104 return *this; |
101 } | 105 } |
102 | 106 |
| 107 #if defined(OS_WIN) |
| 108 Builder& Builder::SetInstance(HINSTANCE instance) { |
| 109 options_.instance = instance; |
| 110 return *this; |
| 111 } |
| 112 |
| 113 Builder& Builder::SetSandboxInfo(sandbox::SandboxInterfaceInfo* sandbox_info) { |
| 114 options_.sandbox_info = sandbox_info; |
| 115 return *this; |
| 116 } |
| 117 #endif // defined(OS_WIN) |
| 118 |
103 Builder& Builder::SetUserDataDir(const base::FilePath& user_data_dir) { | 119 Builder& Builder::SetUserDataDir(const base::FilePath& user_data_dir) { |
104 options_.user_data_dir = user_data_dir; | 120 options_.user_data_dir = user_data_dir; |
105 return *this; | 121 return *this; |
106 } | 122 } |
107 | 123 |
108 Builder& Builder::SetWindowSize(const gfx::Size& window_size) { | 124 Builder& Builder::SetWindowSize(const gfx::Size& window_size) { |
109 options_.window_size = window_size; | 125 options_.window_size = window_size; |
110 return *this; | 126 return *this; |
111 } | 127 } |
112 | 128 |
(...skipping 16 matching lines...) Expand all Loading... |
129 Builder& Builder::SetCrashDumpsDir(const base::FilePath& dir) { | 145 Builder& Builder::SetCrashDumpsDir(const base::FilePath& dir) { |
130 options_.crash_dumps_dir = dir; | 146 options_.crash_dumps_dir = dir; |
131 return *this; | 147 return *this; |
132 } | 148 } |
133 | 149 |
134 Options Builder::Build() { | 150 Options Builder::Build() { |
135 return std::move(options_); | 151 return std::move(options_); |
136 } | 152 } |
137 | 153 |
138 } // namespace headless | 154 } // namespace headless |
OLD | NEW |