named_message_port_connector_fuchsia.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef FUCHSIA_WEB_RUNNERS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_FUCHSIA_H_
  5. #define FUCHSIA_WEB_RUNNERS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_FUCHSIA_H_
  6. #include "components/cast/named_message_port_connector/named_message_port_connector.h"
  7. namespace fuchsia {
  8. namespace web {
  9. class Frame;
  10. }
  11. } // namespace fuchsia
  12. // Publishes NamedMessagePortConnector services to documents loaded in |frame|.
  13. // OnFrameDisconnect() should be called if the FramePtr is torn down before
  14. // |this|.
  15. class NamedMessagePortConnectorFuchsia
  16. : public cast_api_bindings::NamedMessagePortConnector {
  17. public:
  18. explicit NamedMessagePortConnectorFuchsia(fuchsia::web::Frame* frame);
  19. ~NamedMessagePortConnectorFuchsia() override;
  20. NamedMessagePortConnectorFuchsia(const NamedMessagePortConnectorFuchsia&) =
  21. delete;
  22. void operator=(const NamedMessagePortConnectorFuchsia&) = delete;
  23. // Called when the peer Frame connection has terminated.
  24. void DetachFromFrame();
  25. private:
  26. fuchsia::web::Frame* frame_ = nullptr;
  27. };
  28. #endif // FUCHSIA_WEB_RUNNERS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_FUCHSIA_H_