Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: headless/public/headless_browser.h

Issue 2642143002: [headless] Make --hide-scrollbars affect all BrowserContexts. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // as initial screen size. Defaults to 800x600. 142 // as initial screen size. Defaults to 800x600.
143 gfx::Size window_size; 143 gfx::Size window_size;
144 144
145 // Path to user data directory, where browser will look for its state. 145 // Path to user data directory, where browser will look for its state.
146 // If empty, default directory (where the binary is located) will be used. 146 // If empty, default directory (where the binary is located) will be used.
147 base::FilePath user_data_dir; 147 base::FilePath user_data_dir;
148 148
149 // Run a browser context in an incognito mode. Enabled by default. 149 // Run a browser context in an incognito mode. Enabled by default.
150 bool incognito_mode; 150 bool incognito_mode;
151 151
152 // Set a callback that is invoked to override WebPreferences for RenderViews
153 // created within the HeadlessBrowser. Called whenever the WebPreferences of a
154 // RenderView change. Executed on the browser main thread.
155 //
156 // WARNING: We cannot provide any guarantees about the stability of the
157 // exposed WebPreferences API, so use with care.
158 base::Callback<void(WebPreferences*)> override_web_preferences_callback;
159
152 // Reminder: when adding a new field here, do not forget to add it to 160 // Reminder: when adding a new field here, do not forget to add it to
153 // HeadlessBrowserContextOptions (where appropriate). 161 // HeadlessBrowserContextOptions (where appropriate).
154 private: 162 private:
155 Options(int argc, const char** argv); 163 Options(int argc, const char** argv);
156 164
157 DISALLOW_COPY_AND_ASSIGN(Options); 165 DISALLOW_COPY_AND_ASSIGN(Options);
158 }; 166 };
159 167
160 class HeadlessBrowser::Options::Builder { 168 class HeadlessBrowser::Options::Builder {
161 public: 169 public:
(...skipping 11 matching lines...) Expand all
173 Builder& AddMojoServiceName(const std::string& mojo_service_name); 181 Builder& AddMojoServiceName(const std::string& mojo_service_name);
174 182
175 // Per-context settings. 183 // Per-context settings.
176 184
177 Builder& SetUserAgent(const std::string& user_agent); 185 Builder& SetUserAgent(const std::string& user_agent);
178 Builder& SetProxyServer(const net::HostPortPair& proxy_server); 186 Builder& SetProxyServer(const net::HostPortPair& proxy_server);
179 Builder& SetHostResolverRules(const std::string& host_resolver_rules); 187 Builder& SetHostResolverRules(const std::string& host_resolver_rules);
180 Builder& SetWindowSize(const gfx::Size& window_size); 188 Builder& SetWindowSize(const gfx::Size& window_size);
181 Builder& SetUserDataDir(const base::FilePath& user_data_dir); 189 Builder& SetUserDataDir(const base::FilePath& user_data_dir);
182 Builder& SetIncognitoMode(bool incognito_mode); 190 Builder& SetIncognitoMode(bool incognito_mode);
191 Builder& SetOverrideWebPreferencesCallback(
192 base::Callback<void(WebPreferences*)> callback);
183 193
184 Options Build(); 194 Options Build();
185 195
186 private: 196 private:
187 Options options_; 197 Options options_;
188 198
189 DISALLOW_COPY_AND_ASSIGN(Builder); 199 DISALLOW_COPY_AND_ASSIGN(Builder);
190 }; 200 };
191 201
192 // The headless browser may need to create child processes (e.g., a renderer 202 // The headless browser may need to create child processes (e.g., a renderer
(...skipping 23 matching lines...) Expand all
216 // the main loop, it will only return after HeadlessBrowser::Shutdown() is 226 // the main loop, it will only return after HeadlessBrowser::Shutdown() is
217 // called, returning the exit code for the process. It is not possible to 227 // called, returning the exit code for the process. It is not possible to
218 // initialize the browser again after it has been torn down. 228 // initialize the browser again after it has been torn down.
219 int HeadlessBrowserMain( 229 int HeadlessBrowserMain(
220 HeadlessBrowser::Options options, 230 HeadlessBrowser::Options options,
221 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); 231 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback);
222 232
223 } // namespace headless 233 } // namespace headless
224 234
225 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ 235 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_browser_context_options.cc ('k') | headless/public/headless_browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698