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

// Copyright 2018 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 "services/network/public/mojom/url_loader.mojom";
import "services/network/public/mojom/url_loader_factory.mojom";
import "third_party/blink/public/mojom/blob/blob.mojom";
import "third_party/blink/public/mojom/fetch/fetch_api_request.mojom";

// Parameters used for dispatching a FetchEvent.
// This struct is used by ServiceWorker main resource or subreosurce loader,
// those are located in both browser and renderer processes. This is used to
// pass parameters to ServiceWorker global scope.
//
// Specification: https://w3c.github.io/ServiceWorker/#fetchevent-interface
struct DispatchFetchEventParams {
  // FetchEvent#request.
  FetchAPIRequest request;

  // FetchEvent#clientId.
  // The value come from a unique ID generated in the browser process.
  string client_id;

  // FetchEvent#resultingClientId.
  // The value come from a unique ID generated in the browser process.
  string resulting_client_id;

  // FetchEvent#preloadResponse.
  pending_receiver<network.mojom.URLLoaderClient>? preload_url_loader_client_receiver;

  // Whether this is a "fake" fetch event used to detect the offline capability
  // of the service worker. See more details at https://crbug.com/965802.
  bool is_offline_capability_check = false;

  // Used for BestEffortServiceWorker(crbug.com/1420517). Specifies the cusotm
  // URLLoaderFactory if the RaceNetworkRequest is triggered. This value is
  // referred by the fetch process in blink, in order to detect and dedupe
  // the corresponding fetch event in ServiceWorker.
  pending_remote<network.mojom.URLLoaderFactory>? race_network_request_loader_factory;
};