1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49

fuchsia_web / webengine / browser / receiver_session_client.h [blame]

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FUCHSIA_WEB_WEBENGINE_BROWSER_RECEIVER_SESSION_CLIENT_H_
#define FUCHSIA_WEB_WEBENGINE_BROWSER_RECEIVER_SESSION_CLIENT_H_

#include <fuchsia/web/cpp/fidl.h>

#include "components/cast_streaming/common/public/mojom/demuxer_connector.mojom.h"
#include "components/cast_streaming/common/public/mojom/renderer_controller.mojom.h"
#include "mojo/public/cpp/bindings/associated_remote.h"

namespace cast_streaming {
class ReceiverSession;
}  // namespace cast_streaming

// Holds a Cast Streaming Receiver Session.
class ReceiverSessionClient {
 public:
  explicit ReceiverSessionClient(
      fidl::InterfaceRequest<fuchsia::web::MessagePort> message_port_request,
      bool video_only_receiver);
  ReceiverSessionClient(const ReceiverSessionClient& other) = delete;

  ~ReceiverSessionClient();

  ReceiverSessionClient& operator=(const ReceiverSessionClient&) = delete;

  void SetMojoEndpoints(
      mojo::AssociatedRemote<cast_streaming::mojom::DemuxerConnector>
          demuxer_connector,
      mojo::AssociatedRemote<cast_streaming::mojom::RendererController>
          renderer_controller);

  bool HasReceiverSession();

 private:
  // Populated in the ctor, and removed when |receiver_session_| is created in
  // SetDemuxerConnector().
  fidl::InterfaceRequest<fuchsia::web::MessagePort> message_port_request_;

  // Created in SetDemuxerConnector(), and empty prior to that call.
  std::unique_ptr<cast_streaming::ReceiverSession> receiver_session_;

  const bool video_only_receiver_;
};

#endif  // FUCHSIA_WEB_WEBENGINE_BROWSER_RECEIVER_SESSION_CLIENT_H_