chromium/ash/webui/media_app_ui/media_app_ui.mojom

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

module ash.media_app_ui.mojom;

import "third_party/blink/public/mojom/file_system_access/file_system_access_transfer_token.mojom";
import "url/mojom/url.mojom";

// Browser interface for chrome://media-app to bootstrap a connection.
interface PageHandlerFactory {
  // Create a page handler which exposes interfaces implemented in the browser
  // process to the renderer process via |handler|.
  CreatePageHandler(pending_receiver<PageHandler> handler);
};

// An interface implemented in the browser process that is exposed to the
// renderer process for chrome://media-app.
interface PageHandler {
  // Opens the chrome feedback dialog.
  OpenFeedbackDialog() => (string? error_message);
  // Toggles "browser" fullscreen mode for the window.
  ToggleBrowserFullscreenMode() => ();
  // Indicate that a trigger for displaying the PDF HaTS survey has occurred.
  MaybeTriggerPdfHats() => ();
  // Checks if the file path for the file represented by the provided transfer
  // token is in a filesystem that ARC is able to write to. Returns false if
  // |token| can't be resolved to a path.
  IsFileArcWritable(
      pending_remote<blink.mojom.FileSystemAccessTransferToken> token)
      => (bool writable);
  // Checks if the file path for the file represented by the provided transfer
  // token is writable according to Ash. Returns false if |token| can't be
  // resolved to a path.
  IsFileBrowserWritable(
      pending_remote<blink.mojom.FileSystemAccessTransferToken> token)
      => (bool writable);
  // Requests the file represented by the provided transfer token to be launched
  // in Photos with the edit intent.
  EditInPhotos(
      pending_remote<blink.mojom.FileSystemAccessTransferToken> token,
      string mime_type) => ();
  // Requests a <form> submission. MediaApp (along with other SWAs) are still 
  // running in Ash, so if the system is running LaCrOS, additional steps must
  // be taken to make sure the submission is also in LaCrOS. This can be done
  // without Mojo, but this specific API is still needed because LaCrOS form
  // submissions only support GET and POST is required.
  SubmitForm(
    url.mojom.Url url,
    array<int8> payload,
    string header
  ) => ();
};