summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/workers/global_scope_creation_params.cc
blob: c76cd892ea36f269b85b34d3dcc26919ea67f467 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// 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.

#include "third_party/blink/renderer/core/workers/global_scope_creation_params.h"

#include <memory>

#include "base/feature_list.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/script/script_type.mojom-blink.h"
#include "third_party/blink/renderer/platform/network/content_security_policy_parsers.h"

namespace blink {

GlobalScopeCreationParams::GlobalScopeCreationParams(
    const KURL& script_url,
    mojom::blink::ScriptType script_type,
    const String& global_scope_name,
    const String& user_agent,
    const absl::optional<UserAgentMetadata>& ua_metadata,
    scoped_refptr<WebWorkerFetchContext> web_worker_fetch_context,
    Vector<network::mojom::blink::ContentSecurityPolicyPtr>
        outside_content_security_policies,
    Vector<network::mojom::blink::ContentSecurityPolicyPtr>
        response_content_security_policies,
    network::mojom::ReferrerPolicy referrer_policy,
    const SecurityOrigin* starter_origin,
    bool starter_secure_context,
    HttpsState starter_https_state,
    WorkerClients* worker_clients,
    std::unique_ptr<WebContentSettingsClient> content_settings_client,
    const Vector<OriginTrialFeature>* inherited_trial_features,
    const base::UnguessableToken& parent_devtools_token,
    std::unique_ptr<WorkerSettings> worker_settings,
    mojom::blink::V8CacheOptions v8_cache_options,
    WorkletModuleResponsesMap* module_responses_map,
    mojo::PendingRemote<mojom::blink::BrowserInterfaceBroker>
        browser_interface_broker,
    mojo::PendingRemote<blink::mojom::CodeCacheHost> code_cache_host_interface,
    BeginFrameProviderParams begin_frame_provider_params,
    const PermissionsPolicy* parent_permissions_policy,
    base::UnguessableToken agent_cluster_id,
    ukm::SourceId ukm_source_id,
    const absl::optional<ExecutionContextToken>& parent_context_token,
    bool parent_cross_origin_isolated_capability,
    bool parent_isolated_application_capability,
    InterfaceRegistry* interface_registry,
    scoped_refptr<base::SingleThreadTaskRunner>
        agent_group_scheduler_compositor_task_runner)
    : script_url(script_url),
      script_type(script_type),
      global_scope_name(global_scope_name),
      user_agent(user_agent),
      ua_metadata(ua_metadata.value_or(blink::UserAgentMetadata())),
      web_worker_fetch_context(std::move(web_worker_fetch_context)),
      outside_content_security_policies(
          std::move(outside_content_security_policies)),
      response_content_security_policies(
          std::move(response_content_security_policies)),
      referrer_policy(referrer_policy),
      starter_origin(starter_origin ? starter_origin->IsolatedCopy() : nullptr),
      starter_secure_context(starter_secure_context),
      starter_https_state(starter_https_state),
      worker_clients(worker_clients),
      content_settings_client(std::move(content_settings_client)),
      parent_devtools_token(parent_devtools_token),
      worker_settings(std::move(worker_settings)),
      v8_cache_options(v8_cache_options),
      module_responses_map(module_responses_map),
      browser_interface_broker(std::move(browser_interface_broker)),
      code_cache_host_interface(std::move(code_cache_host_interface)),
      begin_frame_provider_params(std::move(begin_frame_provider_params)),
      // At the moment, workers do not support their container policy being set,
      // so it will just be an empty ParsedPermissionsPolicy for now.
      worker_permissions_policy(PermissionsPolicy::CreateFromParentPolicy(
          parent_permissions_policy,
          ParsedPermissionsPolicy() /* container_policy */,
          starter_origin->ToUrlOrigin())),
      agent_cluster_id(agent_cluster_id),
      ukm_source_id(ukm_source_id),
      parent_context_token(parent_context_token),
      parent_cross_origin_isolated_capability(
          parent_cross_origin_isolated_capability),
      parent_isolated_application_capability(
          parent_isolated_application_capability),
      interface_registry(interface_registry),
      agent_group_scheduler_compositor_task_runner(
          std::move(agent_group_scheduler_compositor_task_runner)) {
  this->inherited_trial_features =
      std::make_unique<Vector<OriginTrialFeature>>();
  if (inherited_trial_features) {
    for (OriginTrialFeature feature : *inherited_trial_features)
      this->inherited_trial_features->push_back(feature);
  }
}

}  // namespace blink