chromium/third_party/blink/public/mojom/service_worker/service_worker_installed_scripts_manager.mojom

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

module blink.mojom;

import "url/mojom/url.mojom";

// This is sent from the browser to the renderer on starting worker.
// Contains information about the scripts of an installed service worker.
struct ServiceWorkerInstalledScriptsInfo {
  pending_receiver<ServiceWorkerInstalledScriptsManager> manager_receiver;
  pending_remote<ServiceWorkerInstalledScriptsManagerHost> manager_host_remote;
  array<url.mojom.Url> installed_urls;
};

// This is sent from the browser to the renderer.
// Contains information about a service worker script.
struct ServiceWorkerScriptInfo {
  url.mojom.Url script_url;
  string encoding;
  // HTTP headers of the script.
  map<string, string> headers;
  // A handle for receiving the script body.
  handle<data_pipe_consumer> body;
  uint64 body_size;
  // A handle for receiving the V8 code cached metadata. This is null when no
  // meta data is available.
  handle<data_pipe_consumer>? meta_data;
  uint64 meta_data_size;
};

// Browser-side interface. The renderer uses this interface to request installed
// scripts from the browser process.
interface ServiceWorkerInstalledScriptsManagerHost {
  // Requests to send the installed scripts over
  // ServiceWorkerInstalledScriptsManager::TransferInstalledScript.
  RequestInstalledScript(url.mojom.Url script_url);
};

// Renderer-side interface. The browser uses this interface to send
// information about installed scripts to the renderer.
interface ServiceWorkerInstalledScriptsManager {
  // Starts streaming the script to the renderer.
  TransferInstalledScript(ServiceWorkerScriptInfo script_info);
};