// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Partial Navigator interface for ad-serving experiments.
// FLEDGE: https://github.com/WICG/turtledove/blob/main/FLEDGE.md
// PARAKEET:
// https://github.com/WICG/privacy-preserving-ads/blob/main/Parakeet.md
// Common interest group APIs are behind AdInterestGroupAPI and specific ad
// serving APIs are behing Fledge and Parakeet respectively.
typedef (USVString or FencedFrameConfig) UrnOrConfig;
[
ImplementedAs=NavigatorAuction,
RuntimeEnabled=AdInterestGroupAPI,
SecureContext
] partial interface Navigator {
[CallWith=ScriptState, Measure, RaisesException]
Promise<undefined> joinAdInterestGroup(AuctionAdInterestGroup group, optional double durationSeconds);
[CallWith=ScriptState, Measure, RaisesException]
Promise<undefined> leaveAdInterestGroup(optional AuctionAdInterestGroupKey group);
[CallWith=ScriptState, RaisesException]
Promise<undefined> clearOriginJoinedAdInterestGroups(USVString owner, optional sequence<USVString> groupsToKeep);
[CallWith=ScriptState, Measure, RaisesException]
void updateAdInterestGroups();
[CallWith=ScriptState, Measure, RaisesException]
Promise<DOMString> createAuctionNonce();
[RuntimeEnabled=Fledge, CallWith=ScriptState, Measure, RaisesException]
Promise<UrnOrConfig?> runAdAuction(AuctionAdConfig config);
[RuntimeEnabled=Fledge, CallWith=ScriptState, Measure, RaisesException]
sequence<USVString> adAuctionComponents([Clamp] unsigned short numComponents);
[RuntimeEnabled=AllowURNsInIframes, CallWith=ScriptState, Measure, RaisesException]
Promise<USVString> deprecatedURNToURL(UrnOrConfig urn_or_config, optional boolean send_reports = false);
[RuntimeEnabled=AllowURNsInIframes, CallWith=ScriptState, Measure, RaisesException]
Promise<undefined> deprecatedReplaceInURN(UrnOrConfig urn_or_config, record<USVString, USVString> replacements);
[RuntimeEnabled=FledgeBiddingAndAuctionServerAPI, CallWith=ScriptState, Measure, RaisesException]
Promise<AdAuctionData> getInterestGroupAdAuctionData(AdAuctionDataConfig config);
[RuntimeEnabled=Parakeet, CallWith=ScriptState, Measure, RaisesException]
Promise<Ads> createAdRequest(AdRequestConfig config);
// The implementation resolves with a DOMString instead of a URL object.
[RuntimeEnabled=Parakeet, CallWith=ScriptState, PromiseIDLTypeMismatch, Measure, RaisesException]
Promise<URL> finalizeAd(Ads ads, AuctionAdConfig config);
[RuntimeEnabled=FencedFrames, CallWith=ScriptState]
boolean canLoadAdAuctionFencedFrame();
[RuntimeEnabled=EnforceAnonymityExposure, CallWith=ScriptState]
readonly attribute boolean deprecatedRunAdAuctionEnforcesKAnonymity;
[RuntimeEnabled=FledgeFeatureDetection, SameObject, CallWith=ScriptState] readonly attribute ProtectedAudience protectedAudience;
};