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

Side by Side Diff: headless/public/headless_browser_context.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
« no previous file with comments | « headless/public/headless_browser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_CONTEXT_H_ 5 #ifndef HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_
6 #define HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ 6 #define HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // access to these bindings. If you know what you're doing it may be OK to 96 // access to these bindings. If you know what you're doing it may be OK to
97 // turn them back on. E.g. if headless_lib is being used in a testing 97 // turn them back on. E.g. if headless_lib is being used in a testing
98 // framework which serves the web content from disk that's likely ok. 98 // framework which serves the web content from disk that's likely ok.
99 // 99 //
100 // That said, best pratice is to add a ProtocolHandler to serve the 100 // That said, best pratice is to add a ProtocolHandler to serve the
101 // webcontent over a custom protocol. That way you can be sure that only the 101 // webcontent over a custom protocol. That way you can be sure that only the
102 // things you intend have access to mojo. 102 // things you intend have access to mojo.
103 Builder& EnableUnsafeNetworkAccessWithMojoBindings( 103 Builder& EnableUnsafeNetworkAccessWithMojoBindings(
104 bool enable_http_and_https_if_mojo_used); 104 bool enable_http_and_https_if_mojo_used);
105 105
106 // Set a callback that is invoked to override WebPreferences for RenderViews
107 // created within this HeadlessBrowserContext. Called whenever the
108 // WebPreferences of a RenderView change. Executed on the browser main thread.
109 //
110 // WARNING: We cannot provide any guarantees about the stability of the
111 // exposed WebPreferences API, so use with care.
112 Builder& SetOverrideWebPreferencesCallback(
113 base::Callback<void(WebPreferences*)> callback);
114
115 // By default |HeadlessBrowserContext| inherits the following options from 106 // By default |HeadlessBrowserContext| inherits the following options from
116 // the browser instance. The methods below can be used to override these 107 // the browser instance. The methods below can be used to override these
117 // settings. See HeadlessBrowser::Options for their meaning. 108 // settings. See HeadlessBrowser::Options for their meaning.
118 Builder& SetUserAgent(const std::string& user_agent); 109 Builder& SetUserAgent(const std::string& user_agent);
119 Builder& SetProxyServer(const net::HostPortPair& proxy_server); 110 Builder& SetProxyServer(const net::HostPortPair& proxy_server);
120 Builder& SetHostResolverRules(const std::string& host_resolver_rules); 111 Builder& SetHostResolverRules(const std::string& host_resolver_rules);
121 Builder& SetWindowSize(const gfx::Size& window_size); 112 Builder& SetWindowSize(const gfx::Size& window_size);
122 Builder& SetUserDataDir(const base::FilePath& user_data_dir); 113 Builder& SetUserDataDir(const base::FilePath& user_data_dir);
123 Builder& SetIncognitoMode(bool incognito_mode); 114 Builder& SetIncognitoMode(bool incognito_mode);
115 Builder& SetOverrideWebPreferencesCallback(
116 base::Callback<void(WebPreferences*)> callback);
124 117
125 HeadlessBrowserContext* Build(); 118 HeadlessBrowserContext* Build();
126 119
127 private: 120 private:
128 friend class HeadlessBrowserImpl; 121 friend class HeadlessBrowserImpl;
129 friend class HeadlessBrowserContextImpl; 122 friend class HeadlessBrowserContextImpl;
130 123
131 explicit Builder(HeadlessBrowserImpl* browser); 124 explicit Builder(HeadlessBrowserImpl* browser);
132 125
133 struct MojoBindings { 126 struct MojoBindings {
(...skipping 13 matching lines...) Expand all
147 140
148 std::list<MojoBindings> mojo_bindings_; 141 std::list<MojoBindings> mojo_bindings_;
149 bool enable_http_and_https_if_mojo_used_; 142 bool enable_http_and_https_if_mojo_used_;
150 143
151 DISALLOW_COPY_AND_ASSIGN(Builder); 144 DISALLOW_COPY_AND_ASSIGN(Builder);
152 }; 145 };
153 146
154 } // namespace headless 147 } // namespace headless
155 148
156 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ 149 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_
OLDNEW
« no previous file with comments | « headless/public/headless_browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698