Chromium Code Reviews| 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..9f063e94a52f02de722f51ab5209bf43d18b4abe 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() {} |
| @@ -95,6 +99,7 @@ class HEADLESS_EXPORT HeadlessWebContents::Builder { |
| // 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. |
|
Sami
2017/04/12 14:18:46
Please also mention that this is deprecated.
alex clarke (OOO till 29th)
2017/04/12 15:47:46
Done.
|
| 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); |
| }; |