// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module auction_worklet.mojom;
import "third_party/blink/public/mojom/shared_storage/shared_storage.mojom";
enum AuctionWorkletFunction {
kBidderGenerateBid,
kBidderReportWin,
kSellerScoreAd,
kSellerReportResult,
};
// Interface implemented in the browser for auction worklets to forward shared
// storage requests. Auction worklets only have access to a subset of the shared
// storage API (i.e. the setter methods). We intentionally do not return the
// result of these calls to avoid leaking state to the worklet.
interface AuctionSharedStorageHost {
// Handle sharedStorage.set(): set `key`’s entry to `value`. If
// `ignore_if_present` is true, the entry is not updated if `key` already
// exists.
Set(blink.mojom.SharedStorageKeyArgument key,
blink.mojom.SharedStorageValueArgument value,
bool ignore_if_present,
AuctionWorkletFunction source_auction_worklet_function);
// Handle sharedStorage.append(): append `value` to the entry for `key`.
// Equivalent to "set" if the `key` is not present.
Append(blink.mojom.SharedStorageKeyArgument key,
blink.mojom.SharedStorageValueArgument value,
AuctionWorkletFunction source_auction_worklet_function);
// Handle sharedStorage.delete(): delete the entry at the given `key`.
Delete(blink.mojom.SharedStorageKeyArgument key,
AuctionWorkletFunction source_auction_worklet_function);
// Handle sharedStorage.clear(): delete all entries.
Clear(AuctionWorkletFunction source_auction_worklet_function);
};