#include "content/browser/interest_group/auction_runner.h"
#include <stdint.h>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/feature_list.h"
#include "base/functional/callback.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/types/optional_ref.h"
#include "content/browser/interest_group/ad_auction_page_data.h"
#include "content/browser/interest_group/auction_metrics_recorder.h"
#include "content/browser/interest_group/auction_nonce_manager.h"
#include "content/browser/interest_group/interest_group_auction_reporter.h"
#include "content/browser/interest_group/interest_group_manager_impl.h"
#include "content/browser/interest_group/interest_group_real_time_report_util.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
#include "content/services/auction_worklet/public/mojom/private_aggregation_request.mojom.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/network/public/mojom/client_security_state.mojom.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/interest_group/auction_config.h"
#include "third_party/blink/public/common/interest_group/interest_group.h"
#include "third_party/blink/public/mojom/interest_group/interest_group_types.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
namespace {
auction_worklet::mojom::KAnonymityBidMode DetermineKAnonMode() { … }
blink::AuctionConfig* LookupAuction(
blink::AuctionConfig& config,
const blink::mojom::AuctionAdConfigAuctionIdPtr& auction) { … }
}
std::unique_ptr<AuctionRunner> AuctionRunner::CreateAndStart(
AuctionMetricsRecorder* auction_metrics_recorder,
AuctionWorkletManager* auction_worklet_manager,
AuctionNonceManager* auction_nonce_manager,
InterestGroupManagerImpl* interest_group_manager,
BrowserContext* browser_context,
PrivateAggregationManager* private_aggregation_manager,
AdAuctionPageDataCallback ad_auction_page_data_callback,
InterestGroupAuctionReporter::LogPrivateAggregationRequestsCallback
log_private_aggregation_requests_callback,
const blink::AuctionConfig& auction_config,
const url::Origin& main_frame_origin,
const url::Origin& frame_origin,
network::mojom::ClientSecurityStatePtr client_security_state,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
IsInterestGroupApiAllowedCallback is_interest_group_api_allowed_callback,
AreReportingOriginsAttestedCallback attestation_callback,
mojo::PendingReceiver<AbortableAdAuction> abort_receiver,
RunAuctionCallback callback) { … }
AuctionRunner::~AuctionRunner() = default;
void AuctionRunner::ResolvedPromiseParam(
blink::mojom::AuctionAdConfigAuctionIdPtr auction_id,
blink::mojom::AuctionAdConfigField field,
const std::optional<std::string>& json_value) { … }
void AuctionRunner::ResolvedPerBuyerSignalsPromise(
blink::mojom::AuctionAdConfigAuctionIdPtr auction_id,
const std::optional<base::flat_map<url::Origin, std::string>>&
per_buyer_signals) { … }
void AuctionRunner::ResolvedBuyerTimeoutsPromise(
blink::mojom::AuctionAdConfigAuctionIdPtr auction_id,
blink::mojom::AuctionAdConfigBuyerTimeoutField field,
const blink::AuctionConfig::BuyerTimeouts& buyer_timeouts) { … }
void AuctionRunner::ResolvedDeprecatedRenderURLReplacementsPromise(
blink::mojom::AuctionAdConfigAuctionIdPtr auction_id,
const std::vector<::blink::AuctionConfig::AdKeywordReplacement>&
deprecated_render_url_replacements) { … }
void AuctionRunner::ResolvedBuyerCurrenciesPromise(
blink::mojom::AuctionAdConfigAuctionIdPtr auction_id,
const blink::AuctionConfig::BuyerCurrencies& buyer_currencies) { … }
void AuctionRunner::ResolvedDirectFromSellerSignalsPromise(
blink::mojom::AuctionAdConfigAuctionIdPtr auction_id,
const std::optional<blink::DirectFromSellerSignals>&
direct_from_seller_signals) { … }
void AuctionRunner::ResolvedDirectFromSellerSignalsHeaderAdSlotPromise(
blink::mojom::AuctionAdConfigAuctionIdPtr auction_id,
const std::optional<std::string>&
direct_from_seller_signals_header_ad_slot) { … }
void AuctionRunner::ResolvedAuctionAdResponsePromise(
blink::mojom::AuctionAdConfigAuctionIdPtr auction_id,
mojo_base::BigBuffer response) { … }
void AuctionRunner::ResolvedAdditionalBids(
blink::mojom::AuctionAdConfigAuctionIdPtr auction_id) { … }
void AuctionRunner::Abort() { … }
void AuctionRunner::NormalizeReportingTimeouts() { … }
void AuctionRunner::FailAuction(
bool aborted_by_script,
blink::InterestGroupSet interest_groups_that_bid) { … }
AuctionRunner::AuctionRunner(
AuctionMetricsRecorder* auction_metrics_recorder,
AuctionWorkletManager* auction_worklet_manager,
AuctionNonceManager* auction_nonce_manager,
InterestGroupManagerImpl* interest_group_manager,
BrowserContext* browser_context,
PrivateAggregationManager* private_aggregation_manager,
AdAuctionPageDataCallback ad_auction_page_data_callback,
InterestGroupAuctionReporter::LogPrivateAggregationRequestsCallback
log_private_aggregation_requests_callback,
auction_worklet::mojom::KAnonymityBidMode kanon_mode,
const blink::AuctionConfig& auction_config,
const url::Origin& main_frame_origin,
const url::Origin& frame_origin,
network::mojom::ClientSecurityStatePtr client_security_state,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
IsInterestGroupApiAllowedCallback is_interest_group_api_allowed_callback,
AreReportingOriginsAttestedCallback attestation_callback,
mojo::PendingReceiver<AbortableAdAuction> abort_receiver,
RunAuctionCallback callback)
: … { … }
void AuctionRunner::StartAuction() { … }
void AuctionRunner::OnLoadInterestGroupsComplete(bool success) { … }
void AuctionRunner::OnLoadDebugReportLockoutAndCooldownsComplete(
std::optional<DebugReportLockoutAndCooldowns>
debug_report_lockout_and_cooldowns) { … }
void AuctionRunner::OnBidsGeneratedAndScored(base::TimeTicks start_time,
bool success) { … }
void AuctionRunner::UpdateInterestGroupsPostAuction() { … }
void AuctionRunner::NotifyPromiseResolved(
const blink::mojom::AuctionAdConfigAuctionId* auction_id,
blink::AuctionConfig* config) { … }
data_decoder::DataDecoder* AuctionRunner::GetDataDecoder(
const url::Origin& origin) { … }
std::pair<bool, bool> AuctionRunner::IncludesServerAndOnDeviceAuctions() { … }
}