blob: 5adce3e8b1022a58aa4dbfec70d803f8ec7f9af1 [file] [log] [blame]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module network.mojom;
import "mojo/public/mojom/base/string16.mojom";
// The input argument of the shared storage key. The data will be checked at
// mojom boundary to ensure it meets the length requirement. Avoid using this
// type if you don't intend to check the key's length.
struct SharedStorageKeyArgument {
mojo_base.mojom.String16 data;
};
// The input argument of the shared storage value. The data will be checked at
// mojom boundary to ensure it meets the length requirement. Avoid using this
// type if you don't intend to check the value's length.
struct SharedStorageValueArgument {
mojo_base.mojom.String16 data;
};
// Represents the lock resource name in the Web Locks API. The lock name
// cannot start with '-', which will be validated during serialization.
// https://w3c.github.io/web-locks/#resource-name
struct LockName {
string data;
};
// Request to set the entry at `key` to `value`. If `ignore_if_present` is true,
// the entry is not updated if `key` already exists.
struct SharedStorageSetMethod {
SharedStorageKeyArgument key;
SharedStorageValueArgument value;
bool ignore_if_present;
};
// Request to append `value` to the entry at `key`.
struct SharedStorageAppendMethod {
SharedStorageKeyArgument key;
SharedStorageValueArgument value;
};
// Request to delete the entry at `key`.
struct SharedStorageDeleteMethod {
SharedStorageKeyArgument key;
};
// Request to clear all entries.
struct SharedStorageClearMethod {};
union SharedStorageModifierMethod {
SharedStorageSetMethod set_method;
SharedStorageAppendMethod append_method;
SharedStorageDeleteMethod delete_method;
SharedStorageClearMethod clear_method;
};
// Request to execute `method` with optional parameters.
struct SharedStorageModifierMethodWithOptions {
// The method to execute.
SharedStorageModifierMethod method;
// If provided, the `method` will be executed with a lock acquired on the
// resource with name `with_lock`. `with_lock` shouldn't start with '-'.
LockName? with_lock;
};
// Represents the batchUpdate()'s `methods` argument in the Shared Storage
// API. It will be validated during serialization.
// https://wicg.github.io/shared-storage/#batch-update
struct SharedStorageBatchUpdateMethodsArgument {
array<SharedStorageModifierMethodWithOptions> data;
};