// 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 "services/network/public/mojom/url_loader_factory.mojom";
import "third_party/blink/public/mojom/browser_interface_broker.mojom";
import "third_party/blink/public/mojom/cache_storage/cache_storage.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_container_type.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_worker_client.mojom";
// The name of the InterfaceProviderSpec in service manifests used by the
// frame tree to expose service-worker-specific interfaces between renderer
// and browser.
const string kNavigation_ServiceWorkerSpec = "navigation:service_worker";
// Sent from the browser process to the renderer. Contains parameters used for
// starting a service worker.
//
// TODO(falken): Merge this with EmbeddedWorkerStartParams, there is no logical
// grouping between the two.
struct ServiceWorkerProviderInfoForStartWorker {
// No methods on |host_remote| are called, but it's needed to keep the host
// implementation in the browser process alive.
// TODO(https://crbug.com/931087): Use a separate interface.
pending_associated_remote<ServiceWorkerContainerHost> host_remote;
// The loader to use for loading the worker's main script and
// importScripts().
pending_remote<network.mojom.URLLoaderFactory>? script_loader_factory_remote;
// |cache_storage| is an optional optimization so the service worker can use
// the Cache Storage API immediately without using InterfaceProvider. May be
// NullRemote for service workers created for update checks, as the
// optimization would be wasteful because these workers usually are aborted
// after the byte-to-byte update check before running.
pending_remote<CacheStorage>? cache_storage;
// Used for accessing services from the worker.
pending_remote<blink.mojom.BrowserInterfaceBroker> browser_interface_broker;
};