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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 bool incognito_mode; | 150 bool incognito_mode; |
151 | 151 |
152 // Set a callback that is invoked to override WebPreferences for RenderViews | 152 // Set a callback that is invoked to override WebPreferences for RenderViews |
153 // created within the HeadlessBrowser. Called whenever the WebPreferences of a | 153 // created within the HeadlessBrowser. Called whenever the WebPreferences of a |
154 // RenderView change. Executed on the browser main thread. | 154 // RenderView change. Executed on the browser main thread. |
155 // | 155 // |
156 // WARNING: We cannot provide any guarantees about the stability of the | 156 // WARNING: We cannot provide any guarantees about the stability of the |
157 // exposed WebPreferences API, so use with care. | 157 // exposed WebPreferences API, so use with care. |
158 base::Callback<void(WebPreferences*)> override_web_preferences_callback; | 158 base::Callback<void(WebPreferences*)> override_web_preferences_callback; |
159 | 159 |
| 160 // Minidump crash reporter settings. Crash reporting is disabled by default. |
| 161 // By default crash dumps are written to the directory containing the |
| 162 // executable. |
| 163 bool enable_crash_reporter; |
| 164 base::FilePath crash_dumps_dir; |
| 165 |
160 // Reminder: when adding a new field here, do not forget to add it to | 166 // Reminder: when adding a new field here, do not forget to add it to |
161 // HeadlessBrowserContextOptions (where appropriate). | 167 // HeadlessBrowserContextOptions (where appropriate). |
162 private: | 168 private: |
163 Options(int argc, const char** argv); | 169 Options(int argc, const char** argv); |
164 | 170 |
165 DISALLOW_COPY_AND_ASSIGN(Options); | 171 DISALLOW_COPY_AND_ASSIGN(Options); |
166 }; | 172 }; |
167 | 173 |
168 class HeadlessBrowser::Options::Builder { | 174 class HeadlessBrowser::Options::Builder { |
169 public: | 175 public: |
(...skipping 13 matching lines...) Expand all Loading... |
183 // Per-context settings. | 189 // Per-context settings. |
184 | 190 |
185 Builder& SetUserAgent(const std::string& user_agent); | 191 Builder& SetUserAgent(const std::string& user_agent); |
186 Builder& SetProxyServer(const net::HostPortPair& proxy_server); | 192 Builder& SetProxyServer(const net::HostPortPair& proxy_server); |
187 Builder& SetHostResolverRules(const std::string& host_resolver_rules); | 193 Builder& SetHostResolverRules(const std::string& host_resolver_rules); |
188 Builder& SetWindowSize(const gfx::Size& window_size); | 194 Builder& SetWindowSize(const gfx::Size& window_size); |
189 Builder& SetUserDataDir(const base::FilePath& user_data_dir); | 195 Builder& SetUserDataDir(const base::FilePath& user_data_dir); |
190 Builder& SetIncognitoMode(bool incognito_mode); | 196 Builder& SetIncognitoMode(bool incognito_mode); |
191 Builder& SetOverrideWebPreferencesCallback( | 197 Builder& SetOverrideWebPreferencesCallback( |
192 base::Callback<void(WebPreferences*)> callback); | 198 base::Callback<void(WebPreferences*)> callback); |
| 199 Builder& SetCrashReporterEnabled(bool enabled); |
| 200 Builder& SetCrashDumpsDir(const base::FilePath& dir); |
193 | 201 |
194 Options Build(); | 202 Options Build(); |
195 | 203 |
196 private: | 204 private: |
197 Options options_; | 205 Options options_; |
198 | 206 |
199 DISALLOW_COPY_AND_ASSIGN(Builder); | 207 DISALLOW_COPY_AND_ASSIGN(Builder); |
200 }; | 208 }; |
201 | 209 |
202 // The headless browser may need to create child processes (e.g., a renderer | 210 // The headless browser may need to create child processes (e.g., a renderer |
(...skipping 23 matching lines...) Expand all Loading... |
226 // the main loop, it will only return after HeadlessBrowser::Shutdown() is | 234 // the main loop, it will only return after HeadlessBrowser::Shutdown() is |
227 // called, returning the exit code for the process. It is not possible to | 235 // called, returning the exit code for the process. It is not possible to |
228 // initialize the browser again after it has been torn down. | 236 // initialize the browser again after it has been torn down. |
229 int HeadlessBrowserMain( | 237 int HeadlessBrowserMain( |
230 HeadlessBrowser::Options options, | 238 HeadlessBrowser::Options options, |
231 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); | 239 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); |
232 | 240 |
233 } // namespace headless | 241 } // namespace headless |
234 | 242 |
235 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 243 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
OLD | NEW |