chromium/chrome/browser/ui/webui/ash/borealis_installer/borealis_installer.mojom

// Copyright 2023 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.borealis_installer.mojom;

import "chrome/browser/ash/borealis/borealis_types.mojom";

// Lives in the browser process. A renderer uses this to create a page handler
// for controlling Borealis installation.
interface PageHandlerFactory {
  // Creates a page handler to enable communication with the browser process.
  CreatePageHandler(pending_remote<Page> page,
                    pending_receiver<PageHandler> handler);
};

// Lives in the renderer process. The browser uses this to send installation.
interface PageHandler {
  // Start installation.
  Install();
  // Shut down the VM.
  ShutDown();
  // Launch Borealis.
  Launch();
  // Cancel installation.
  CancelInstall();
  // This is called when the web page is "closed", and the dialog (or whatever)
  // hosting it should also be closed. This can happen as a result of
  // Page::RequestClose() being called, or it can happen spontaneously (e.g.
  // user clicking cancel on the page or installation finished).
  OnPageClosed();
  // Called when install finishes with kDlcNeedSpaceError and the user clicks
  // on the storage management button. This will open the storage page in
  // settings.
  OpenStoragePage();
};

// Lives in the renderer process. The browser uses this to sends installation
// updates to the web page in the render.
interface Page {
  // Called to update the install percentage.
  OnProgressUpdate(double progress_fraction, string label);
  // Called when installation finishes.
  OnInstallFinished(borealis.mojom.InstallResult error);
  // Informs the page that it should be closed. The page should respond with
  // PageHandler::OnPageClosed() to indicate it is ready to be closed.
  RequestClose();
};