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 #ifndef HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 5 #ifndef HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
6 #define HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 6 #define HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <unordered_map> | 10 #include <unordered_map> |
| 11 #include <unordered_set> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/callback.h" | 14 #include "base/callback.h" |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
17 #include "headless/public/headless_browser_context.h" | 18 #include "headless/public/headless_browser_context.h" |
18 #include "headless/public/headless_export.h" | 19 #include "headless/public/headless_export.h" |
19 #include "headless/public/headless_web_contents.h" | 20 #include "headless/public/headless_web_contents.h" |
20 #include "net/base/host_port_pair.h" | 21 #include "net/base/host_port_pair.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 109 |
109 // Run the browser without renderer sandbox. This option can be | 110 // Run the browser without renderer sandbox. This option can be |
110 // a security risk and should be used with caution. | 111 // a security risk and should be used with caution. |
111 bool disable_sandbox; | 112 bool disable_sandbox; |
112 | 113 |
113 // Choose the GL implementation to use for rendering. A suitable | 114 // Choose the GL implementation to use for rendering. A suitable |
114 // implementantion is selected by default. Setting this to an empty | 115 // implementantion is selected by default. Setting this to an empty |
115 // string can be used to disable GL rendering (e.g., WebGL support). | 116 // string can be used to disable GL rendering (e.g., WebGL support). |
116 std::string gl_implementation; | 117 std::string gl_implementation; |
117 | 118 |
| 119 // Names of mojo services exposed by the browser to the renderer. These |
| 120 // services will be added to the browser's service manifest. |
| 121 std::unordered_set<std::string> mojo_service_names; |
| 122 |
118 // Default per-context options, can be specialized on per-context basis. | 123 // Default per-context options, can be specialized on per-context basis. |
119 | 124 |
120 std::string user_agent; | 125 std::string user_agent; |
121 | 126 |
122 // Address of the HTTP/HTTPS proxy server to use. The system proxy settings | 127 // Address of the HTTP/HTTPS proxy server to use. The system proxy settings |
123 // are used by default. | 128 // are used by default. |
124 net::HostPortPair proxy_server; | 129 net::HostPortPair proxy_server; |
125 | 130 |
126 // Comma-separated list of rules that control how hostnames are mapped. See | 131 // Comma-separated list of rules that control how hostnames are mapped. See |
127 // chrome::switches::kHostRules for a description for the format. | 132 // chrome::switches::kHostRules for a description for the format. |
(...skipping 24 matching lines...) Expand all Loading... |
152 Builder(); | 157 Builder(); |
153 ~Builder(); | 158 ~Builder(); |
154 | 159 |
155 // Browser-wide settings. | 160 // Browser-wide settings. |
156 | 161 |
157 Builder& EnableDevToolsServer(const net::IPEndPoint& endpoint); | 162 Builder& EnableDevToolsServer(const net::IPEndPoint& endpoint); |
158 Builder& SetMessagePump(base::MessagePump* message_pump); | 163 Builder& SetMessagePump(base::MessagePump* message_pump); |
159 Builder& SetSingleProcessMode(bool single_process_mode); | 164 Builder& SetSingleProcessMode(bool single_process_mode); |
160 Builder& SetDisableSandbox(bool disable_sandbox); | 165 Builder& SetDisableSandbox(bool disable_sandbox); |
161 Builder& SetGLImplementation(const std::string& gl_implementation); | 166 Builder& SetGLImplementation(const std::string& gl_implementation); |
| 167 Builder& AddMojoServiceName(const std::string& mojo_service_name); |
162 | 168 |
163 // Per-context settings. | 169 // Per-context settings. |
164 | 170 |
165 Builder& SetUserAgent(const std::string& user_agent); | 171 Builder& SetUserAgent(const std::string& user_agent); |
166 Builder& SetProxyServer(const net::HostPortPair& proxy_server); | 172 Builder& SetProxyServer(const net::HostPortPair& proxy_server); |
167 Builder& SetHostResolverRules(const std::string& host_resolver_rules); | 173 Builder& SetHostResolverRules(const std::string& host_resolver_rules); |
168 Builder& SetWindowSize(const gfx::Size& window_size); | 174 Builder& SetWindowSize(const gfx::Size& window_size); |
169 Builder& SetUserDataDir(const base::FilePath& user_data_dir); | 175 Builder& SetUserDataDir(const base::FilePath& user_data_dir); |
170 Builder& SetIncognitoMode(bool incognito_mode); | 176 Builder& SetIncognitoMode(bool incognito_mode); |
171 | 177 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // the main loop, it will only return after HeadlessBrowser::Shutdown() is | 210 // the main loop, it will only return after HeadlessBrowser::Shutdown() is |
205 // called, returning the exit code for the process. It is not possible to | 211 // called, returning the exit code for the process. It is not possible to |
206 // initialize the browser again after it has been torn down. | 212 // initialize the browser again after it has been torn down. |
207 int HeadlessBrowserMain( | 213 int HeadlessBrowserMain( |
208 HeadlessBrowser::Options options, | 214 HeadlessBrowser::Options options, |
209 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); | 215 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); |
210 | 216 |
211 } // namespace headless | 217 } // namespace headless |
212 | 218 |
213 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 219 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
OLD | NEW |