blob: 5a02fcb15c80d6ae65afb6e54e47cc9b9a7dbc6d [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// 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/cross_origin_embedder_policy.mojom";
import "services/network/public/mojom/fetch_api.mojom";
import "third_party/blink/public/mojom/blob/blob_url_store.mojom";
import "third_party/blink/public/mojom/browser_interface_broker.mojom";
import "third_party/blink/public/mojom/loader/fetch_client_settings_object.mojom";
import "third_party/blink/public/mojom/worker/subresource_loader_updater.mojom";
import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom";
import "third_party/blink/public/mojom/worker/dedicated_worker_host.mojom";
import "third_party/blink/public/mojom/worker/worker_main_script_load_params.mojom";
import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom";
import "third_party/blink/public/mojom/tokens/tokens.mojom";
import "url/mojom/url.mojom";
// The name of the InterfaceProviderSpec in service manifests used by the
// frame tree to expose dedicated-worker-specific interfaces between renderer
// and browser.
const string kNavigation_DedicatedWorkerSpec = "navigation:dedicated_worker";
// PlzDedicatedWorker:
// An interface implemented by clients (e.g., the renderer where "new Worker()"
// was invoked) to observe events on the DedicatedWorkerHostFactory.
interface DedicatedWorkerHostFactoryClient {
// Called when the worker host is created.
OnWorkerHostCreated(
// Used for accessing services from the worker.
pending_remote<blink.mojom.BrowserInterfaceBroker>
browser_interface_broker,
// Used for updating its state from the worker.
pending_remote<DedicatedWorkerHost> host);
// Called when the worker host started loading the main worker script. This
// is called after OnWorkerHostCreated(). This is never called when
// OnScriptLoadStartFailed() is called.
OnScriptLoadStarted(
// The info about the service worker container host in the browser process
// that provides support for this worker to be a service worker client.
//
// This is null if the dedicated worker cannot be a service
// worker client, because for example, the worker's URL is
// not http(s) or another service worker supported scheme.
ServiceWorkerContainerInfoForClient? service_worker_container_info,
// Used for passing the main script pre-requested by the browser process
// and its redirect information.
WorkerMainScriptLoadParams main_script_load_params,
// Used for loading subresources. This also supports non-network URLs like
// chrome-extension:// URLs.
URLLoaderFactoryBundle subresource_loader_factories,
// Used for updating subresource loaders after NetworkService crash.
pending_receiver<SubresourceLoaderUpdater> subresource_loader_updater,
// Used to make fetches from the worker go through the controller service
// worker. This is null when there're no controller service worker.
ControllerServiceWorkerInfo? controller_info);
// Called when the worker host fails to start loading the main worker script.
// This is called after OnWorkerHostCreated(). This is never called when
// OnScriptLoadStarted() is called.
OnScriptLoadStartFailed();
};
// An interface used to instantiate a dedicated worker host. The implementation
// of this interface lives in the browser process.
interface DedicatedWorkerHostFactory {
// Non-PlzDedicatedWorker:
// The factory client should call this instead of
// CreateWorkerHostAndStartScriptLoad() when PlzDedicatedWorker is disabled.
//
// Creates a new DedicatedWorkerHost, and requests |browser_interface_broker|
// to provide the worker access to mojo interfaces.
CreateWorkerHost(
blink.mojom.DedicatedWorkerToken token,
pending_receiver<blink.mojom.BrowserInterfaceBroker>
browser_interface_broker,
pending_receiver<DedicatedWorkerHost> host) =>
(network.mojom.CrossOriginEmbedderPolicy parent_coep);
// PlzDedicatedWorker:
// The factory client should call this instead of CreateWorkerHost() when
// PlzDedicatedWorker is enabled.
//
// Creates a new DedicatedWorkerHost, and requests to start top-level worker
// script loading for |script_url| using |credentials_mode| and
// |outside_fetch_client_settings_object|.
// |blob_url_token| should be non-null when |script_url| is a blob URL.
// |client| is used for notifying the renderer process of results of worker
// host creation and script loading.
CreateWorkerHostAndStartScriptLoad(
blink.mojom.DedicatedWorkerToken token,
url.mojom.Url script_url,
network.mojom.CredentialsMode credentials_mode,
blink.mojom.FetchClientSettingsObject
outside_fetch_client_settings_object,
pending_remote<blink.mojom.BlobURLToken>? blob_url_token,
pending_remote<DedicatedWorkerHostFactoryClient> client);
};