#include "content/services/auction_worklet/trusted_signals_request_manager.h"
#include <stdint.h>
#include <cmath>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/containers/unique_ptr_adapters.h"
#include "base/feature_list.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
#include "content/services/auction_worklet/auction_v8_helper.h"
#include "content/services/auction_worklet/public/cpp/auction_network_events_delegate.h"
#include "content/services/auction_worklet/trusted_signals.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
#include "third_party/blink/public/common/features.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace auction_worklet {
class TrustedSignalsRequestManager::TrustedSignalsUrlBuilder { … };
class TrustedSignalsRequestManager::TrustedBiddingSignalsUrlBuilder
: public TrustedSignalsRequestManager::TrustedSignalsUrlBuilder { … };
class TrustedSignalsRequestManager::TrustedScoringSignalsUrlBuilder
: public TrustedSignalsRequestManager::TrustedSignalsUrlBuilder { … };
TrustedSignalsRequestManager::TrustedSignalsRequestManager(
Type type,
network::mojom::URLLoaderFactory* url_loader_factory,
mojo::PendingRemote<auction_worklet::mojom::AuctionNetworkEventsHandler>
auction_network_events_handler,
bool automatically_send_requests,
const url::Origin& top_level_origin,
const GURL& trusted_signals_url,
std::optional<uint16_t> experiment_group_id,
const std::string& trusted_bidding_signals_slot_size_param,
mojom::TrustedSignalsPublicKeyPtr public_key,
AuctionV8Helper* v8_helper)
: … { … }
TrustedSignalsRequestManager::~TrustedSignalsRequestManager() { … }
std::unique_ptr<TrustedSignalsRequestManager::Request>
TrustedSignalsRequestManager::RequestBiddingSignals(
const std::string& interest_group_name,
const std::optional<std::vector<std::string>>& keys,
int32_t max_trusted_bidding_signals_url_length,
LoadSignalsCallback load_signals_callback) { … }
std::unique_ptr<TrustedSignalsRequestManager::Request>
TrustedSignalsRequestManager::RequestScoringSignals(
const GURL& render_url,
const std::vector<std::string>& ad_component_render_urls,
int32_t max_trusted_scoring_signals_url_length,
LoadSignalsCallback load_signals_callback) { … }
void TrustedSignalsRequestManager::IssueRequests(
TrustedSignalsUrlBuilder& url_builder) { … }
void TrustedSignalsRequestManager::StartBatchedTrustedSignalsRequest() { … }
TrustedSignalsRequestManager::RequestImpl::RequestImpl(
TrustedSignalsRequestManager* trusted_signals_request_manager,
const std::string& interest_group_name,
std::set<std::string> bidder_keys,
int32_t max_trusted_bidding_signals_url_length,
LoadSignalsCallback load_signals_callback)
: … { … }
TrustedSignalsRequestManager::RequestImpl::RequestImpl(
TrustedSignalsRequestManager* trusted_signals_request_manager,
const GURL& render_url,
std::set<std::string> ad_component_render_urls,
int32_t max_trusted_scoring_signals_url_length,
LoadSignalsCallback load_signals_callback)
: … { … }
TrustedSignalsRequestManager::RequestImpl::~RequestImpl() { … }
TrustedSignalsRequestManager::BatchedTrustedSignalsRequest::
BatchedTrustedSignalsRequest() = default;
TrustedSignalsRequestManager::BatchedTrustedSignalsRequest::
~BatchedTrustedSignalsRequest() = default;
bool TrustedSignalsRequestManager::CompareRequestImpl::operator()(
const RequestImpl* r1,
const RequestImpl* r2) const { … }
void TrustedSignalsRequestManager::OnSignalsLoaded(
BatchedTrustedSignalsRequest* batched_request,
scoped_refptr<Result> result,
std::optional<std::string> error_msg) { … }
void TrustedSignalsRequestManager::OnRequestDestroyed(RequestImpl* request) { … }
void TrustedSignalsRequestManager::QueueRequest(RequestImpl* request) { … }
}