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> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Comma-separated list of rules that control how hostnames are mapped. See | 107 // Comma-separated list of rules that control how hostnames are mapped. See |
108 // chrome::switches::kHostRules for a description for the format. | 108 // chrome::switches::kHostRules for a description for the format. |
109 std::string host_resolver_rules; | 109 std::string host_resolver_rules; |
110 | 110 |
111 // Run the browser in single process mode instead of using separate renderer | 111 // Run the browser in single process mode instead of using separate renderer |
112 // processes as per default. Note that this also disables any sandboxing of | 112 // processes as per default. Note that this also disables any sandboxing of |
113 // web content, which can be a security risk. | 113 // web content, which can be a security risk. |
114 bool single_process_mode; | 114 bool single_process_mode; |
115 | 115 |
| 116 // Run the browser without renderer sandbox. This option can be |
| 117 // a security risk and should be used with caution. |
| 118 bool disable_sandbox; |
| 119 |
116 // Custom network protocol handlers. These can be used to override URL | 120 // Custom network protocol handlers. These can be used to override URL |
117 // fetching for different network schemes. | 121 // fetching for different network schemes. |
118 ProtocolHandlerMap protocol_handlers; | 122 ProtocolHandlerMap protocol_handlers; |
119 | 123 |
120 private: | 124 private: |
121 Options(int argc, const char** argv); | 125 Options(int argc, const char** argv); |
122 | 126 |
123 DISALLOW_COPY_AND_ASSIGN(Options); | 127 DISALLOW_COPY_AND_ASSIGN(Options); |
124 }; | 128 }; |
125 | 129 |
126 class HeadlessBrowser::Options::Builder { | 130 class HeadlessBrowser::Options::Builder { |
127 public: | 131 public: |
128 Builder(int argc, const char** argv); | 132 Builder(int argc, const char** argv); |
129 Builder(); | 133 Builder(); |
130 ~Builder(); | 134 ~Builder(); |
131 | 135 |
132 Builder& SetUserAgent(const std::string& user_agent); | 136 Builder& SetUserAgent(const std::string& user_agent); |
133 Builder& EnableDevToolsServer(const net::IPEndPoint& endpoint); | 137 Builder& EnableDevToolsServer(const net::IPEndPoint& endpoint); |
134 Builder& SetMessagePump(base::MessagePump* message_pump); | 138 Builder& SetMessagePump(base::MessagePump* message_pump); |
135 Builder& SetProxyServer(const net::HostPortPair& proxy_server); | 139 Builder& SetProxyServer(const net::HostPortPair& proxy_server); |
136 Builder& SetHostResolverRules(const std::string& host_resolver_rules); | 140 Builder& SetHostResolverRules(const std::string& host_resolver_rules); |
137 Builder& SetSingleProcessMode(bool single_process_mode); | 141 Builder& SetSingleProcessMode(bool single_process_mode); |
| 142 Builder& SetDisableSandbox(bool disable_sandbox); |
138 Builder& SetProtocolHandlers(ProtocolHandlerMap protocol_handlers); | 143 Builder& SetProtocolHandlers(ProtocolHandlerMap protocol_handlers); |
139 | 144 |
140 Options Build(); | 145 Options Build(); |
141 | 146 |
142 private: | 147 private: |
143 Options options_; | 148 Options options_; |
144 | 149 |
145 DISALLOW_COPY_AND_ASSIGN(Builder); | 150 DISALLOW_COPY_AND_ASSIGN(Builder); |
146 }; | 151 }; |
147 | 152 |
(...skipping 24 matching lines...) Expand all Loading... |
172 // the main loop, it will only return after HeadlessBrowser::Shutdown() is | 177 // the main loop, it will only return after HeadlessBrowser::Shutdown() is |
173 // called, returning the exit code for the process. It is not possible to | 178 // called, returning the exit code for the process. It is not possible to |
174 // initialize the browser again after it has been torn down. | 179 // initialize the browser again after it has been torn down. |
175 int HeadlessBrowserMain( | 180 int HeadlessBrowserMain( |
176 HeadlessBrowser::Options options, | 181 HeadlessBrowser::Options options, |
177 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); | 182 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); |
178 | 183 |
179 } // namespace headless | 184 } // namespace headless |
180 | 185 |
181 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 186 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
OLD | NEW |