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

content / services / auction_worklet / public / mojom / auction_shared_storage_host.mojom [blame]

// 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);
};