chromium/third_party/blink/public/common/tokens/tokens.h

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_TOKENS_TOKENS_H_
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_TOKENS_TOKENS_H_

#include "base/types/token_type.h"
#include "third_party/blink/public/common/tokens/multi_token.h"
#include "ui/base/clipboard/clipboard_sequence_number_token.h"

namespace blink {

// Various token types. These are used as cross-layer and cross-process
// identifiers for objects that exist in blink, but which have representations
// in the browser process. They should not be used to identify objects in
// browser-to-renderer control messages; rather, such messages should exist as
// methods on the interface bound to the object itself. They are fine to use
// for informational messages that cross over other interfaces, in both
// directions.
//
// See README.md for more details.

////////////////////////////////////////////////////////////////////////////////
// DOCUMENT TOKENS
DocumentToken;

////////////////////////////////////////////////////////////////////////////////
// FRAME TOKENS

// Uniquely identifies a blink::LocalFrame / blink::WebLocalFrame /
// content::RenderFrame in a renderer process, and its content::RenderFrameHost
// counterpart in the browser.
LocalFrameToken;

// Uniquely identifies a blink::RemoteFrame / blink::WebRemoteFrame /
// content::RenderFrameProxy in a renderer process, and its
// content::RenderFrameProxyHost counterpart in the browser. There can be
// multiple RemoteFrames corresponding to a single LocalFrame, and each token
// will be distinct.
RemoteFrameToken;

// Can represent either type of FrameToken.
FrameToken;

////////////////////////////////////////////////////////////////////////////////
// WORKER TOKENS

// Identifies a blink::DedicatedWorkerGlobalScope in the renderer and a
// content::DedicatedWorkerHost in the browser.
DedicatedWorkerToken;

// Identifies a blink::ServiceWorkerGlobalScope in the renderer and a
// content::ServiceWorkerVersion in the browser.
ServiceWorkerToken;

// Identifies a blink::SharedWorkerGlobalScope in the renderer and a
// content::SharedWorkerHost in the browser.
SharedWorkerToken;

// Can represent any type of WorkerToken.
WorkerToken;

////////////////////////////////////////////////////////////////////////////////
// WORKLET TOKENS

// Identifies an animation worklet.
AnimationWorkletToken;

// Identifies an audio worklet.
AudioWorkletToken;

// Identifies a layout worklet.
LayoutWorkletToken;

// Identifies a paint worklet.
PaintWorkletToken;

// Identifies a shared storage worklet.
SharedStorageWorkletToken;

// Can represent any type of WorkletToken.
WorkletToken;

////////////////////////////////////////////////////////////////////////////////
// SHADOW REALM TOKENS
ShadowRealmToken;

////////////////////////////////////////////////////////////////////////////////
// OTHER TOKENS
//
// Keep this section last.
//
// If you have multiple tokens that make a thematic group, please lift them to
// their own section, in alphabetical order. If adding a new token here, please
// keep the following list in alphabetic order.

// Identifies an attributionsrc request made by the Attribution Reporting API.
AttributionSrcToken;

// Identifies a unique clipboard state.
ClipboardSequenceNumberToken;

// Identifies an arbitrary ExecutionContext. Each concrete implementation of an
// ExecutionContext has a distinct token type that can be represented here.
ExecutionContextToken;

// Identifies the destination of a screenshot for a same-document navigation.
SameDocNavigationScreenshotDestinationToken;

// Identifies a v8::Context / blink::ScriptState.
V8ContextToken;

ViewTransitionToken;

// Identifies possible contexts used for WebGPU. Used in cross-process mojo
// interfaces for isolation key coordination.
// TODO(dawn:549) Might be able to eventually swap this out to use
//     ExecutionContextToken from above with DocumentToken gets encapsulated
//     there later on.
WebGPUExecutionContextToken;

// Identifies a ML context in a renderer process and the WebNN service.
WebNNContextToken;

// Identifies a ML buffer in a renderer process and the WebNN service.
WebNNBufferToken;

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_PUBLIC_COMMON_TOKENS_TOKENS_H_