module electron.mojom;

import "mojo/public/mojom/base/string16.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "third_party/blink/public/mojom/messaging/cloneable_message.mojom";
import "third_party/blink/public/mojom/messaging/transferable_message.mojom";

interface ElectronRenderer {
  Message(
      bool internal,
      string channel,
      blink.mojom.CloneableMessage arguments);

  ReceivePostMessage(string channel, blink.mojom.TransferableMessage message);

  TakeHeapSnapshot(handle file) => (bool success);
};

interface ElectronAutofillAgent {
  AcceptDataListSuggestion(mojo_base.mojom.String16 value);
};

interface ElectronAutofillDriver {
  ShowAutofillPopup(gfx.mojom.RectF bounds, array<mojo_base.mojom.String16> values, array<mojo_base.mojom.String16> labels);
  HideAutofillPopup();
};

interface ElectronWebContentsUtility {
  // Informs underlying WebContents that first non-empty layout was performed
  // by compositor.
  OnFirstNonEmptyLayout();

  SetTemporaryZoomLevel(double zoom_level);

  [Sync]
  DoGetZoomLevel() => (double result);
};

interface ElectronApiIPC {
  // Emits an event on |channel| from the ipcMain JavaScript object in the main
  // process.
  Message(
      bool internal,
      string channel,
      blink.mojom.CloneableMessage arguments);

  // Emits an event on |channel| from the ipcMain JavaScript object in the main
  // process, and returns the response.
  Invoke(
      bool internal,
      string channel,
      blink.mojom.CloneableMessage arguments) => (blink.mojom.CloneableMessage result);

  ReceivePostMessage(string channel, blink.mojom.TransferableMessage message);

  // Emits an event on |channel| from the ipcMain JavaScript object in the main
  // process, and waits synchronously for a response.
  [Sync]
  MessageSync(
    bool internal,
    string channel,
    blink.mojom.CloneableMessage arguments) => (blink.mojom.CloneableMessage result);

  MessageHost(
    string channel,
    blink.mojom.CloneableMessage arguments);
};
