| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 bool single_process_mode; | 114 bool single_process_mode; |
| 115 | 115 |
| 116 // Run the browser without renderer sandbox. This option can be | 116 // Run the browser without renderer sandbox. This option can be |
| 117 // a security risk and should be used with caution. | 117 // a security risk and should be used with caution. |
| 118 bool disable_sandbox; | 118 bool disable_sandbox; |
| 119 | 119 |
| 120 // Custom network protocol handlers. These can be used to override URL | 120 // Custom network protocol handlers. These can be used to override URL |
| 121 // fetching for different network schemes. | 121 // fetching for different network schemes. |
| 122 ProtocolHandlerMap protocol_handlers; | 122 ProtocolHandlerMap protocol_handlers; |
| 123 | 123 |
| 124 // Choose the GL implementation to use for rendering. A suitable |
| 125 // implementantion is selected by default. Setting this to an empty |
| 126 // string can be used to disable GL rendering (e.g., WebGL support). |
| 127 std::string gl_implementation; |
| 128 |
| 124 private: | 129 private: |
| 125 Options(int argc, const char** argv); | 130 Options(int argc, const char** argv); |
| 126 | 131 |
| 127 DISALLOW_COPY_AND_ASSIGN(Options); | 132 DISALLOW_COPY_AND_ASSIGN(Options); |
| 128 }; | 133 }; |
| 129 | 134 |
| 130 class HeadlessBrowser::Options::Builder { | 135 class HeadlessBrowser::Options::Builder { |
| 131 public: | 136 public: |
| 132 Builder(int argc, const char** argv); | 137 Builder(int argc, const char** argv); |
| 133 Builder(); | 138 Builder(); |
| 134 ~Builder(); | 139 ~Builder(); |
| 135 | 140 |
| 136 Builder& SetUserAgent(const std::string& user_agent); | 141 Builder& SetUserAgent(const std::string& user_agent); |
| 137 Builder& EnableDevToolsServer(const net::IPEndPoint& endpoint); | 142 Builder& EnableDevToolsServer(const net::IPEndPoint& endpoint); |
| 138 Builder& SetMessagePump(base::MessagePump* message_pump); | 143 Builder& SetMessagePump(base::MessagePump* message_pump); |
| 139 Builder& SetProxyServer(const net::HostPortPair& proxy_server); | 144 Builder& SetProxyServer(const net::HostPortPair& proxy_server); |
| 140 Builder& SetHostResolverRules(const std::string& host_resolver_rules); | 145 Builder& SetHostResolverRules(const std::string& host_resolver_rules); |
| 141 Builder& SetSingleProcessMode(bool single_process_mode); | 146 Builder& SetSingleProcessMode(bool single_process_mode); |
| 142 Builder& SetDisableSandbox(bool disable_sandbox); | 147 Builder& SetDisableSandbox(bool disable_sandbox); |
| 143 Builder& SetProtocolHandlers(ProtocolHandlerMap protocol_handlers); | 148 Builder& SetProtocolHandlers(ProtocolHandlerMap protocol_handlers); |
| 149 Builder& SetGLImplementation(const std::string& gl_implementation); |
| 144 | 150 |
| 145 Options Build(); | 151 Options Build(); |
| 146 | 152 |
| 147 private: | 153 private: |
| 148 Options options_; | 154 Options options_; |
| 149 | 155 |
| 150 DISALLOW_COPY_AND_ASSIGN(Builder); | 156 DISALLOW_COPY_AND_ASSIGN(Builder); |
| 151 }; | 157 }; |
| 152 | 158 |
| 153 // The headless browser may need to create child processes (e.g., a renderer | 159 // The headless browser may need to create child processes (e.g., a renderer |
| (...skipping 23 matching lines...) Expand all Loading... |
| 177 // the main loop, it will only return after HeadlessBrowser::Shutdown() is | 183 // the main loop, it will only return after HeadlessBrowser::Shutdown() is |
| 178 // called, returning the exit code for the process. It is not possible to | 184 // called, returning the exit code for the process. It is not possible to |
| 179 // initialize the browser again after it has been torn down. | 185 // initialize the browser again after it has been torn down. |
| 180 int HeadlessBrowserMain( | 186 int HeadlessBrowserMain( |
| 181 HeadlessBrowser::Options options, | 187 HeadlessBrowser::Options options, |
| 182 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); | 188 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); |
| 183 | 189 |
| 184 } // namespace headless | 190 } // namespace headless |
| 185 | 191 |
| 186 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 192 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
| OLD | NEW |