chromium/components/guest_view/common/guest_view.mojom

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

module guest_view.mojom;

import "mojo/public/mojom/base/values.mojom";

// An interface to track how long a view is alive for. The interface
// will be disconnected when the renderer has garbage collected the
// view.
interface ViewHandle {
};

// The renderer uses this interface to create GuestViews, make requests to the
// browser to attach a GuestView to a container frame, and notify the browser
// of state relating to a guest's container.
interface GuestViewHost {
  // This `GuestViewHost` is associated with a `RenderFrame`/local frame.
  // We want this local frame to be replaced with a remote frame that points
  // to a GuestView. This message will attach the local frame to the guest.
  // The GuestView is identified by its ID: `guest_instance_id`.
  AttachToEmbedderFrame(
      int32 element_instance_id,
      int32 guest_instance_id,
      mojo_base.mojom.DictionaryValue params) => ();

  // Sent by the renderer when a GuestView (identified by `view_instance_id`)
  // has been created in JavaScript. When the view has been garbage collected
  // `keep_alive_handle_receiver`  will be disconnected.
  ViewCreated(int32 view_instance_id, string view_type,
              pending_receiver<ViewHandle> keep_alive_handle_receiver);
};