Chromium Code Reviews| Index: headless/public/headless_tab_socket.h |
| diff --git a/headless/public/headless_tab_socket.h b/headless/public/headless_tab_socket.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..efc2323759f98231ebc5776371f3df8e9e881b1d |
| --- /dev/null |
| +++ b/headless/public/headless_tab_socket.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef HEADLESS_PUBLIC_HEADLESS_TAB_SOCKET_H_ |
| +#define HEADLESS_PUBLIC_HEADLESS_TAB_SOCKET_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "headless/public/headless_export.h" |
| + |
| +namespace headless { |
| + |
| +// A bidirectional communications channel between C++ and JS. |
| +class HEADLESS_EXPORT HeadlessTabSocket { |
| + public: |
| + class HEADLESS_EXPORT Listener { |
| + public: |
| + Listener() {} |
| + virtual ~Listener() {} |
| + |
| + virtual void OnMessageFromTab(const std::string& message) = 0; |
|
Sami
2017/04/12 14:18:46
Maybe add a note here reminding that the message m
alex clarke (OOO till 29th)
2017/04/12 15:47:46
Done.
|
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Listener); |
| + }; |
| + |
| + virtual void SendMessageToTab(const std::string& message) = 0; |
| + |
| + virtual void SetListener(Listener* listener) = 0; |
| + |
| + protected: |
| + HeadlessTabSocket() {} |
| + virtual ~HeadlessTabSocket() {} |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(HeadlessTabSocket); |
| +}; |
| + |
| +} // namespace headless |
| + |
| +#endif // HEADLESS_PUBLIC_HEADLESS_TAB_SOCKET_H_ |