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

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

Issue 2873283002: [Reland] Allow headless TabSocket in isolated worlds & remove obsolete logic (Closed)
Patch Set: Fix GN Issue Created 3 years, 7 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_WEB_CONTENTS_H_ 5 #ifndef HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_
6 #define HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_ 6 #define HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 // Set an initial URL to ensure that the renderer gets initialized and 106 // Set an initial URL to ensure that the renderer gets initialized and
107 // eventually becomes ready to be inspected. See 107 // eventually becomes ready to be inspected. See
108 // HeadlessWebContents::Observer::DevToolsTargetReady. The default URL is 108 // HeadlessWebContents::Observer::DevToolsTargetReady. The default URL is
109 // about:blank. 109 // about:blank.
110 Builder& SetInitialURL(const GURL& initial_url); 110 Builder& SetInitialURL(const GURL& initial_url);
111 111
112 // Specify the initial window size (default is configured in browser options). 112 // Specify the initial window size (default is configured in browser options).
113 Builder& SetWindowSize(const gfx::Size& size); 113 Builder& SetWindowSize(const gfx::Size& size);
114 114
115 // Whether or not a headless tab socket should be created, to allow JS -> C++ 115 enum class TabSocketType {
116 // embedder communications. 116 NONE, // No TabSocket binds created (default).
117 Builder& CreateTabSocket(bool create_tab_socket); 117 MAIN_WORLD, // TabSocket bindings available only to the main world.
118 ISOLATED_WORLD // TabSocket bindings available only to isolated worlds
119 // created via DevTools protocol.
120 };
121
122 // Sets the type of TabSocket to be created, if any.
123 Builder& SetTabSocketType(TabSocketType type);
118 124
119 // The returned object is owned by HeadlessBrowser. Call 125 // The returned object is owned by HeadlessBrowser. Call
120 // HeadlessWebContents::Close() to dispose it. 126 // HeadlessWebContents::Close() to dispose it.
121 HeadlessWebContents* Build(); 127 HeadlessWebContents* Build();
122 128
123 private: 129 private:
124 friend class HeadlessBrowserImpl; 130 friend class HeadlessBrowserImpl;
125 friend class HeadlessBrowserContextImpl; 131 friend class HeadlessBrowserContextImpl;
126 friend class HeadlessWebContentsImpl; 132 friend class HeadlessWebContentsImpl;
127 133
(...skipping 19 matching lines...) Expand all
147 153
148 private: 154 private:
149 DISALLOW_COPY_AND_ASSIGN(MojoService); 155 DISALLOW_COPY_AND_ASSIGN(MojoService);
150 }; 156 };
151 157
152 HeadlessBrowserContextImpl* browser_context_; 158 HeadlessBrowserContextImpl* browser_context_;
153 159
154 GURL initial_url_ = GURL("about:blank"); 160 GURL initial_url_ = GURL("about:blank");
155 gfx::Size window_size_; 161 gfx::Size window_size_;
156 std::list<MojoService> mojo_services_; 162 std::list<MojoService> mojo_services_;
157 bool create_tab_socket_ = false; 163 TabSocketType tab_socket_type_ = TabSocketType::NONE;
158 164
159 DISALLOW_COPY_AND_ASSIGN(Builder); 165 DISALLOW_COPY_AND_ASSIGN(Builder);
160 }; 166 };
161 167
162 } // namespace headless 168 } // namespace headless
163 169
164 #endif // HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_ 170 #endif // HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_
OLDNEW
« no previous file with comments | « headless/lib/renderer/headless_content_renderer_client.cc ('k') | headless/test/headless_browser_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698