Skip to content

Commit

Permalink
[Chromecast] Add binding function for mojom::Remotee
Browse files Browse the repository at this point in the history
crrev.com/c/2066398 implements the remoting renderer and related
components. In order to allow Chromecast to use the remoting
renderer, ReceiverController should bind to a mojom::Remotee
instance from browser process to be able to send/receive data
to/from the browser process.

Bug: internal b/157539433
Test: CQ build
Change-Id: Ia65c30330e45d5c7a78003469d6ef35892efbc71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2187650
Auto-Submit: Chih-Hsuan Kuo <chkuo@google.com>
Commit-Queue: Chih-Hsuan Kuo <chkuo@google.com>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#776991}
  • Loading branch information
kuoe0 authored and Commit Bot committed Jun 10, 2020
1 parent 49dfdf7 commit 2ee54c3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions chromecast/browser/cast_browser_interface_binders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "components/network_hints/common/network_hints.mojom.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "media/mojo/mojom/remoting.mojom.h"

namespace chromecast {
namespace shell {
Expand Down Expand Up @@ -39,6 +40,20 @@ void BindApplicationMediaCapabilities(
mojom::ApplicationMediaCapabilities::Name_, &interface_pipe);
}

void BindMediaRemotingRemotee(
content::RenderFrameHost* frame_host,
mojo::PendingReceiver<::media::mojom::Remotee> receiver) {
auto* web_contents = content::WebContents::FromRenderFrameHost(frame_host);
if (!web_contents)
return;
auto* cast_web_contents = CastWebContents::FromWebContents(web_contents);
if (!cast_web_contents || !cast_web_contents->can_bind_interfaces())
return;
auto interface_pipe = receiver.PassPipe();
cast_web_contents->binder_registry()->TryBindInterface(
::media::mojom::Remotee::Name_, &interface_pipe);
}

} // namespace

void PopulateCastFrameBinders(
Expand All @@ -48,6 +63,8 @@ void PopulateCastFrameBinders(
base::BindRepeating(&BindNetworkHintsHandler));
binder_map->Add<mojom::ApplicationMediaCapabilities>(
base::BindRepeating(&BindApplicationMediaCapabilities));
binder_map->Add<::media::mojom::Remotee>(
base::BindRepeating(&BindMediaRemotingRemotee));
}

} // namespace shell
Expand Down

0 comments on commit 2ee54c3

Please sign in to comment.