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