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

Unified Diff: headless/public/headless_web_contents.h

Issue 2813953002: Add HeadlessTabSocket (Closed)
Patch Set: Change HeadlessTabSocketImpl::SetListener Created 3 years, 8 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/public/headless_tab_socket.h ('k') | headless/test/headless_browser_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/public/headless_web_contents.h
diff --git a/headless/public/headless_web_contents.h b/headless/public/headless_web_contents.h
index 70c92abf4739d0d01e6aea9d42252399c23ed916..bbae478c5fdbcffdf2e60e5b7c13fc4faa27b719 100644
--- a/headless/public/headless_web_contents.h
+++ b/headless/public/headless_web_contents.h
@@ -21,6 +21,7 @@ namespace headless {
class HeadlessBrowserContextImpl;
class HeadlessBrowserImpl;
class HeadlessDevToolsTarget;
+class HeadlessTabSocket;
// Class representing contents of a browser tab. Should be accessed from browser
// main thread.
@@ -71,6 +72,9 @@ class HEADLESS_EXPORT HeadlessWebContents {
// Close this page. |HeadlessWebContents| object will be destroyed.
virtual void Close() = 0;
+ // Returns the headless tab socket for JS -> C++ if one was created.
+ virtual HeadlessTabSocket* GetHeadlessTabSocket() const = 0;
+
private:
friend class HeadlessWebContentsImpl;
HeadlessWebContents() {}
@@ -92,9 +96,10 @@ class HEADLESS_EXPORT HeadlessWebContents::Builder {
// Specify the initial window size (default is configured in browser options).
Builder& SetWindowSize(const gfx::Size& size);
- // Specify an embedder provided Mojo service to be installed. The
+ // DEPRECATED. Specify an embedder provided Mojo service to be installed. The
// |service_factory| callback is called on demand by Mojo to instantiate the
// service if a client asks for it.
+ // TODO(alexclarke): Remove AddMojoService.
template <typename Interface>
Builder& AddMojoService(
const base::Callback<void(mojo::InterfaceRequest<Interface>)>&
@@ -108,6 +113,10 @@ class HEADLESS_EXPORT HeadlessWebContents::Builder {
const base::Callback<void(
mojo::ScopedMessagePipeHandle)>& service_factory);
+ // Whether or not a headless tab socket should be created, to allow JS -> C++
+ // embedder communications.
+ Builder& CreateTabSocket(bool create_tab_socket);
+
// The returned object is owned by HeadlessBrowser. Call
// HeadlessWebContents::Close() to dispose it.
HeadlessWebContents* Build();
@@ -146,6 +155,7 @@ class HEADLESS_EXPORT HeadlessWebContents::Builder {
GURL initial_url_ = GURL("about:blank");
gfx::Size window_size_;
std::list<MojoService> mojo_services_;
+ bool create_tab_socket_ = false;
DISALLOW_COPY_AND_ASSIGN(Builder);
};
« no previous file with comments | « headless/public/headless_tab_socket.h ('k') | headless/test/headless_browser_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698