blob: 71f1e166fecb0b8d846a47647b80cb8ae9d7a1ec [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 content.mojom;
import "content/common/url_loader_factory_bundle.mojom";
import "content/public/common/renderer_preference_watcher.mojom";
import "content/public/common/renderer_preferences.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "services/network/public/mojom/url_loader_factory.mojom";
import "services/service_manager/public/mojom/interface_provider.mojom";
import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_provider.mojom";
import "third_party/blink/public/mojom/worker/shared_worker.mojom";
import "third_party/blink/public/mojom/worker/shared_worker_host.mojom";
import "third_party/blink/public/mojom/worker/shared_worker_info.mojom";
import "third_party/blink/public/mojom/worker/worker_main_script_load_params.mojom";
import "third_party/blink/public/web/worker_content_settings_proxy.mojom";
// The name of the InterfaceProviderSpec in service manifests used by the
// frame tree to expose shared-worker-specific interfaces between renderer and
// browser.
const string kNavigation_SharedWorkerSpec = "navigation:shared_worker";
// This interface is used to instantiate a shared worker. It is exported from a
// child process where the shared worker should run.
interface SharedWorkerFactory {
// Create a new shared worker. The |host| interface receives events from the
// shared worker.
//
// TODO(sammc): Change shared workers to obtain |content_settings| via
// |interface_provider| instead of receiving plumbing it here.
CreateSharedWorker(
blink.mojom.SharedWorkerInfo info,
bool pause_on_start,
mojo_base.mojom.UnguessableToken devtools_worker_token,
RendererPreferences renderer_preferences,
RendererPreferenceWatcher& preference_watcher_request,
blink.mojom.WorkerContentSettingsProxy content_settings,
// S13nServiceWorker:
// The info about the service worker host in the browser process that
// provides support for this shared worker to be a service worker client.
// Null when S13nServiceWorker is disabled.
blink.mojom.ServiceWorkerProviderInfoForSharedWorker?
service_worker_provider_info,
// NetworkService:
// The ID of the AppCacheHost in the browser process that serves resources
// for this shared worker. This is kAppCacheNoHostId when NetworkService
// is disabled or AppCache doesn't serve resources for this shared worker.
int32 appcache_host_id,
// S13nServiceWorker (non-NetworkService):
// The URLLoaderFactory to use to request the shared worker's script
// (just the main script resource; importScripts() should go through the
// usual loader or the controller service worker if appropriate).
//
// This is only non-null when S13nServiceWorker is enabled but
// NetworkService is disabled.
//
// It doesn't really need to be associated, but a similar associated
// interface ptr is sent for service worker startup, so making this
// associated too simplifies code on the renderer, as
// ServiceWorkerNetworkProvider::script_loader_factory_ can be an
// associated interface ptr used for both service worker and shared
// worker execution contexts.
associated network.mojom.URLLoaderFactory? main_script_loader_factory,
// NetworkService (PlzWorker):
// Used for passing a main script pre-requested by the browser process and
// its redirect information.
blink.mojom.WorkerMainScriptLoadParams? main_script_load_params,
// NetworkService:
// When the Network Service is enabled, |subresource_loader_factories|
// may also be provided a means for the shared worker to load
// subresources where applicable. For example, this allows the shared
// worker to load chrome-extension:// URLs which the renderer's default
// loader factory can't load.
URLLoaderFactoryBundle? subresource_loader_factories,
// NetworkService (PlzWorker):
// Used for setting ServiceWorkerContainer#controller. This is null when
// NetworkService is disabled or there're no controller service worker.
//
// In S13nServiceWorker, the controller is sent via
// ServiceWorkerContainer.SetController().
blink.mojom.ControllerServiceWorkerInfo? controller_info,
blink.mojom.SharedWorkerHost host,
blink.mojom.SharedWorker& shared_worker,
service_manager.mojom.InterfaceProvider interface_provider);
};