blob: 8583e1690e1cfe1af3f970de7adb72eae08d7256 [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/url_loader_factory.mojom";
import "third_party/blink/public/mojom/browser_interface_broker.mojom";
import "services/service_manager/public/mojom/interface_provider.mojom";
import "third_party/blink/public/mojom/cache_storage/cache_storage.mojom";
import "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_provider_type.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_registration.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 info needed
// for a service worker client (window or web worker) to talk with the
// ServiceWorkerContainerHost in the browser process.
struct ServiceWorkerProviderInfoForClient {
associated ServiceWorkerContainerHost host_ptr_info;
associated ServiceWorkerContainer& client_request;
};
// 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_ptr_info| 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.
associated ServiceWorkerContainerHost host_ptr_info;
// The loader to use for loading the worker's main script and
// importScripts().
network.mojom.URLLoaderFactory? script_loader_factory_ptr_info;
// |cache_storage| is an optional optimization so the service worker can use
// the Cache Storage API immediately without using InterfaceProvider. May be
// null 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.
CacheStorage? cache_storage;
// TODO(crbug.com/990845): remove when no longer used.
service_manager.mojom.InterfaceProvider interface_provider;
// Used for accessing services from the worker.
// Should replace the |interface_provider| above.
pending_remote<blink.mojom.BrowserInterfaceBroker> browser_interface_broker;
};
// ServiceWorkerWorkerClient represents a service worker client that is a worker
// (i.e., a shared worker or dedicated worker). The main thread of
// the renderer process uses this interface to tell the worker thread
// when the controller service worker changes.
interface ServiceWorkerWorkerClient {
// Called when the worker is controlled by a new service worker. This is only
// used to let the worker know that we now have a service worker (while there
// may or may not have been one previously), but not the other way around.
OnControllerChanged(ControllerServiceWorkerMode mode);
};
// ServiceWorkerWorkerClientRegistry is a mojo interface for hosting and
// registering ServiceWorkerWorkerClients. An instance of this interface is
// implemented by ServiceWorkerProviderContext and lives in the same renderer
// process as the worker clients.
// This interface is useful when one needs to register a new worker client
// for an existing ServiceWorkerProviderContext on non-main thread, i.e. for
// nested workers.
interface ServiceWorkerWorkerClientRegistry {
// Adds a new ServiceWorkerWorkerClient.
RegisterWorkerClient(ServiceWorkerWorkerClient client);
// Clones this host.
CloneWorkerClientRegistry(ServiceWorkerWorkerClientRegistry& host);
};