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

Unified Diff: headless/public/headless_browser_context.h

Issue 2374063002: Headless: expose WebPreferences to embedder, add --hide-scrollbars. (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/lib/browser/headless_content_browser_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/public/headless_browser_context.h
diff --git a/headless/public/headless_browser_context.h b/headless/public/headless_browser_context.h
index d041c0a3e923056a99c5421e013ee2730a40ffda..b6d41576621610ecf4c55451e7bc1f5600a4bed4 100644
--- a/headless/public/headless_browser_context.h
+++ b/headless/public/headless_browser_context.h
@@ -12,6 +12,7 @@
#include <vector>
#include "base/optional.h"
+#include "content/public/common/web_preferences.h"
#include "headless/public/headless_export.h"
#include "headless/public/headless_web_contents.h"
#include "net/base/host_port_pair.h"
@@ -25,6 +26,10 @@ namespace headless {
class HeadlessBrowserImpl;
class HeadlessBrowserContextOptions;
+// Imported into headless namespace for
+// Builder::SetOverrideWebPreferencesCallback().
+using content::WebPreferences;
+
using ProtocolHandlerMap = std::unordered_map<
std::string,
std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>>;
@@ -97,6 +102,14 @@ class HEADLESS_EXPORT HeadlessBrowserContext::Builder {
Builder& EnableUnsafeNetworkAccessWithMojoBindings(
bool enable_http_and_https_if_mojo_used);
+ // Set a callback that is invoked to override WebPreferences for RenderViews
+ // created within this HeadlessBrowserContext.
Sami 2016/09/29 09:38:26 This is called on the browser main thread, right?
Eric Seckler 2016/09/30 09:17:50 It's definitely called multiple times (whenever th
+ //
+ // WARNING: We cannot provide any guarantees about the stability of the
+ // exposed WebPreferences API, so use with care.
+ Builder& SetOverrideWebPreferencesCallback(
+ std::function<void(WebPreferences*)> callback);
Sami 2016/09/29 09:38:26 This should probably be a base::Callback since mos
Eric Seckler 2016/09/30 09:17:50 Done.
+
// By default |HeadlessBrowserContext| inherits the following options from
// the browser instance. The methods below can be used to override these
// settings. See HeadlessBrowser::Options for their meaning.
« no previous file with comments | « headless/lib/browser/headless_content_browser_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698