summaryrefslogtreecommitdiff
path: root/chromium/content/common/shared_worker/shared_worker_factory.mojom
blob: 13c068af65a3cfc5837ada14c8f074569d7ca16f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// 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/service_worker/service_worker_provider.mojom";
import "content/common/shared_worker/shared_worker.mojom";
import "content/common/shared_worker/shared_worker_host.mojom";
import "content/common/shared_worker/shared_worker_info.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/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(
      SharedWorkerInfo info,
      bool pause_on_start,
      mojo_base.mojom.UnguessableToken devtools_worker_token,
      blink.mojom.WorkerContentSettingsProxy content_settings,

      // S13nServiceWorker:
      // The info about the host in the browser process that provides support
      // for this shared worker to be a service worker client. Null when
      // S13nServiceWorker is disabled.
      ServiceWorkerProviderInfoForSharedWorker? service_worker_provider_info,

      // S13nServiceWorker:
      // 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).
      //
      // Null when S13nServiceWorker 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? script_loader_factory_ptr_info,

      SharedWorkerHost host,
      SharedWorker& shared_worker,
      service_manager.mojom.InterfaceProvider interface_provider);
};