Commit fbf69561 authored by Mario Sanchez Prada's avatar Mario Sanchez Prada Committed by Commit Bot

Migrate references of blink::mojom::DisplayCutoutClient to new Mojo types

Convert the remaining bits in both the implementation and clients from the
browser and renderer processes for the blink.mojom.DisplayCutoutClient
interface, and adapt tests.

Bug: 955171, 978694
Change-Id: I48cc1a9129b3796a60ff510d18d36a0ad37bd28b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817883Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Commit-Queue: Mario Sanchez Prada <mario@igalia.com>
Cr-Commit-Position: refs/heads/master@{#699521}
parent 9f31191d
......@@ -22,6 +22,7 @@
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
......@@ -159,8 +160,9 @@ class DisplayCutoutBrowserTest : public ContentBrowserTest {
}
void SendSafeAreaToFrame(int top, int left, int bottom, int right) {
blink::mojom::DisplayCutoutClientAssociatedPtr client;
MainFrame()->GetRemoteAssociatedInterfaces()->GetInterface(&client);
mojo::AssociatedRemote<blink::mojom::DisplayCutoutClient> client;
MainFrame()->GetRemoteAssociatedInterfaces()->GetInterface(
client.BindNewEndpointAndPassReceiver());
client->SetSafeArea(
blink::mojom::DisplayCutoutSafeArea::New(top, left, bottom, right));
}
......
......@@ -7,6 +7,7 @@
#include "content/browser/display_cutout/display_cutout_constants.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/navigation_handle.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
......@@ -146,8 +147,8 @@ void DisplayCutoutHostImpl::SendSafeAreaToFrame(RenderFrameHost* rfh,
if (!provider)
return;
blink::mojom::DisplayCutoutClientAssociatedPtr client;
provider->GetInterface(&client);
mojo::AssociatedRemote<blink::mojom::DisplayCutoutClient> client;
provider->GetInterface(client.BindNewEndpointAndPassReceiver());
client->SetSafeArea(blink::mojom::DisplayCutoutSafeArea::New(
insets.top(), insets.left(), insets.bottom(), insets.right()));
}
......
......@@ -185,8 +185,9 @@ void BlinkInitializer::RegisterInterfaces(
void BlinkInitializer::InitLocalFrame(LocalFrame& frame) const {
if (RuntimeEnabledFeatures::DisplayCutoutAPIEnabled()) {
frame.GetInterfaceRegistry()->AddAssociatedInterface(WTF::BindRepeating(
&DisplayCutoutClientImpl::BindMojoRequest, WrapWeakPersistent(&frame)));
frame.GetInterfaceRegistry()->AddAssociatedInterface(
WTF::BindRepeating(&DisplayCutoutClientImpl::BindMojoReceiver,
WrapWeakPersistent(&frame)));
}
frame.GetInterfaceRegistry()->AddAssociatedInterface(WTF::BindRepeating(
&DevToolsFrontendImpl::BindMojoRequest, WrapWeakPersistent(&frame)));
......
......@@ -25,15 +25,16 @@ String GetPx(int value) {
DisplayCutoutClientImpl::DisplayCutoutClientImpl(
LocalFrame* frame,
mojom::blink::DisplayCutoutClientAssociatedRequest request)
: frame_(frame), binding_(this, std::move(request)) {}
mojo::PendingAssociatedReceiver<mojom::blink::DisplayCutoutClient> receiver)
: frame_(frame), receiver_(this, std::move(receiver)) {}
void DisplayCutoutClientImpl::BindMojoRequest(
void DisplayCutoutClientImpl::BindMojoReceiver(
LocalFrame* frame,
mojom::blink::DisplayCutoutClientAssociatedRequest request) {
mojo::PendingAssociatedReceiver<mojom::blink::DisplayCutoutClient>
receiver) {
if (!frame)
return;
MakeGarbageCollected<DisplayCutoutClientImpl>(frame, std::move(request));
MakeGarbageCollected<DisplayCutoutClientImpl>(frame, std::move(receiver));
}
void DisplayCutoutClientImpl::SetSafeArea(
......
......@@ -5,7 +5,8 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DISPLAY_CUTOUT_CLIENT_IMPL_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DISPLAY_CUTOUT_CLIENT_IMPL_H_
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "third_party/blink/public/mojom/page/display_cutout.mojom-blink.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
......@@ -20,12 +21,13 @@ class CORE_EXPORT DisplayCutoutClientImpl final
: public GarbageCollected<DisplayCutoutClientImpl>,
public mojom::blink::DisplayCutoutClient {
public:
static void BindMojoRequest(
static void BindMojoReceiver(
LocalFrame*,
mojom::blink::DisplayCutoutClientAssociatedRequest);
mojo::PendingAssociatedReceiver<mojom::blink::DisplayCutoutClient>);
DisplayCutoutClientImpl(LocalFrame*,
mojom::blink::DisplayCutoutClientAssociatedRequest);
DisplayCutoutClientImpl(
LocalFrame*,
mojo::PendingAssociatedReceiver<mojom::blink::DisplayCutoutClient>);
// Notify the renderer that the safe areas have changed.
void SetSafeArea(mojom::blink::DisplayCutoutSafeAreaPtr safe_area) override;
......@@ -35,7 +37,7 @@ class CORE_EXPORT DisplayCutoutClientImpl final
private:
Member<LocalFrame> frame_;
mojo::AssociatedBinding<mojom::blink::DisplayCutoutClient> binding_;
mojo::AssociatedReceiver<mojom::blink::DisplayCutoutClient> receiver_;
DISALLOW_COPY_AND_ASSIGN(DisplayCutoutClientImpl);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment