blob: c8ebbbc51f4515e8f65501f8135d117bf74cf440 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
import "mojo/public/mojom/base/time.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "third_party/blink/public/mojom/messaging/transferable_message.mojom";
import "third_party/blink/public/mojom/loader/referrer.mojom";
import "url/mojom/origin.mojom";
import "url/mojom/url.mojom";
import "url/mojom/origin.mojom";
enum PortalActivateResult {
// The predecessor was not adopted by its successor and will be
// unloaded.
kPredecessorWillUnload,
// The predecessor was adopted by its successor.
kPredecessorWasAdopted,
// The activation could not proceed because the portal had not yet begun
// to load a document, or its load was canceled.
kRejectedDueToPortalNotReady,
// The activation could not proceed because the portal is showing an error
// page.
kRejectedDueToErrorInPortal,
// The activation could not proceed since the predecessor main frame was
// navigating and the navigation could not be cancelled.
kRejectedDueToPredecessorNavigation,
// The connection with the remote was closed (usually happens during a
// browser shutdown). This error code is never sent as an IPC response, but
// is synthesized by the renderer.
kDisconnected,
// The activation was attempted but was aborted due to a logic error, such as
// a nonsensical reply from the other renderer. This should never happen; it
// is always an indication of a bug if it does.
kAbortedDueToBug,
};
// The Portal interface is used by the HTMLPortalElement in the outer renderer
// process to interact with the browser side implementation of a portal
// (content::Portal). It is 1:1 with PortalClient (defined below).
interface Portal {
// Navigates the portal to |url|.
Navigate(url.mojom.Url url, Referrer referrer) => ();
// When a portal is activated, it'll replace the current tab with the portal.
// |activation_time| represents the time where HTMLPortalElement.activate()
// was called. The |trace_id| is used to generate activation flow events for
// performance tracing.
Activate(TransferableMessage data, mojo_base.mojom.TimeTicks activation_time,
uint64 trace_id) => (PortalActivateResult result);
// Sends message to the browser process, where it can be forwarded to the
// portal's main frame.
PostMessageToGuest(TransferableMessage message);
};
// The PortalClient interface is used by the browser side implementation of a
// portal to communicate with its host HTMLPortalElement in the outer renderer
// process. It is 1:1 with Portal (defined above).
interface PortalClient {
// Forwards message sent from the portal's guest to the portal's host
// HTMLPortalElement.
ForwardMessageFromGuest(TransferableMessage message,
url.mojom.Origin source_origin);
// Dispatches the load event on the HTMLPortalElement when the portal finishes
// loading.
DispatchLoadEvent();
};
// Used by blink::PortalHost in the inner renderer process to communicate with
// the browser side representation of the portal (content::Portal).
interface PortalHost {
// Sends message to the browser process, from where it can be delivered to
// the portal's host HTMLPortalElement.
PostMessageToHost(TransferableMessage message);
};