#include "content/browser/interest_group/bidding_and_auction_server_key_fetcher.h"
#include "base/base64.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/metrics/histogram_functions.h"
#include "base/rand_util.h"
#include "content/browser/interest_group/interest_group_features.h"
#include "content/browser/interest_group/interest_group_manager_impl.h"
#include "net/base/isolation_info.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "third_party/blink/public/common/features.h"
namespace content {
namespace {
constexpr base::TimeDelta kKeyRequestInterval = …;
constexpr base::TimeDelta kRequestTimeout = …;
const size_t kMaxBodySize = …;
constexpr net::NetworkTrafficAnnotationTag
kBiddingAndAuctionServerKeyFetchTrafficAnnotation = …;
}
BiddingAndAuctionServerKeyFetcher::PerCoordinatorFetcherState::
PerCoordinatorFetcherState() = default;
BiddingAndAuctionServerKeyFetcher::PerCoordinatorFetcherState::
~PerCoordinatorFetcherState() = default;
BiddingAndAuctionServerKeyFetcher::PerCoordinatorFetcherState::
PerCoordinatorFetcherState(PerCoordinatorFetcherState&& state) = default;
BiddingAndAuctionServerKeyFetcher::PerCoordinatorFetcherState&
BiddingAndAuctionServerKeyFetcher::PerCoordinatorFetcherState::operator=(
PerCoordinatorFetcherState&& state) = default;
BiddingAndAuctionServerKeyFetcher::BiddingAndAuctionServerKeyFetcher(
InterestGroupManagerImpl* manager,
scoped_refptr<network::SharedURLLoaderFactory> loader_factory)
: … { … }
BiddingAndAuctionServerKeyFetcher::~BiddingAndAuctionServerKeyFetcher() =
default;
void BiddingAndAuctionServerKeyFetcher::MaybePrefetchKeys() { … }
void BiddingAndAuctionServerKeyFetcher::GetOrFetchKey(
std::optional<url::Origin> maybe_coordinator,
BiddingAndAuctionServerKeyFetcherCallback callback) { … }
void BiddingAndAuctionServerKeyFetcher::FetchKeys(
const url::Origin& coordinator,
PerCoordinatorFetcherState& state,
BiddingAndAuctionServerKeyFetcherCallback callback) { … }
void BiddingAndAuctionServerKeyFetcher::OnFetchKeysFromDatabaseComplete(
const url::Origin coordinator,
std::pair<base::Time, std::vector<BiddingAndAuctionServerKey>>
expiration_and_keys) { … }
void BiddingAndAuctionServerKeyFetcher::FetchKeysFromNetwork(
const url::Origin& coordinator) { … }
void BiddingAndAuctionServerKeyFetcher::OnFetchKeysFromNetworkComplete(
url::Origin coordinator,
std::unique_ptr<std::string> response) { … }
void BiddingAndAuctionServerKeyFetcher::OnParsedKeys(
url::Origin coordinator,
data_decoder::DataDecoder::ValueOrError result) { … }
void BiddingAndAuctionServerKeyFetcher::CacheKeysAndRunAllCallbacks(
const url::Origin& coordinator,
const std::vector<BiddingAndAuctionServerKey>& keys,
base::Time expiration) { … }
void BiddingAndAuctionServerKeyFetcher::FailAllCallbacks(
url::Origin coordinator) { … }
}