chromium/content/services/auction_worklet/direct_from_seller_signals_requester.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/services/auction_worklet/direct_from_seller_signals_requester.h"

#include <list>
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#include "base/check.h"
#include "base/functional/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/not_fatal_until.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "content/services/auction_worklet/auction_v8_helper.h"
#include "content/services/auction_worklet/public/cpp/auction_downloader.h"
#include "net/http/http_response_headers.h"
#include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "url/gurl.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-local-handle.h"
#include "v8/include/v8-primitive.h"
#include "v8/include/v8-value.h"

namespace auction_worklet {

namespace {

// Validates that the Ad-Auction-Only (or deprecated X-FLEDGE-Auction-Only)
// header is present. Returns std::nullopt upon success. Upon failure, returns
// an error string.
//
// NOTE: This check is *NOT* directly part of the DirectFromSellerSignals
// security model, and serves more as a convenience check for developers: the
// network service and browser process ensure that resources that have the
// "Ad-Auction-Only: true" header are only usable in FLEDGE auctions. This
// check reminds developers using DirectFromSellerSignals to use
// Ad-Auction-Only on subresource responses to ensure that these responses
// are protected (by the browser and network stack) from being using outside
// FLEDGE.
std::optional<std::string> CheckHeader(
    scoped_refptr<net::HttpResponseHeaders> headers) {}

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class DirectFromSellerSignalsRequestType {};

}  // namespace

DirectFromSellerSignalsRequester::Result::Result() = default;

DirectFromSellerSignalsRequester::Result::Result(Result&&) = default;

DirectFromSellerSignalsRequester::Result&
DirectFromSellerSignalsRequester::Result::operator=(Result&&) = default;

DirectFromSellerSignalsRequester::Result::~Result() = default;

v8::Local<v8::Value> DirectFromSellerSignalsRequester::Result::GetSignals(
    AuctionV8Helper& v8_helper,
    v8::Local<v8::Context> context,
    std::vector<std::string>& errors) const {}

bool DirectFromSellerSignalsRequester::Result::IsNull() const {}

DirectFromSellerSignalsRequester::Result::ResponseString::ResponseString(
    std::string&& other)
    :{}

DirectFromSellerSignalsRequester::Result::ResponseString::~ResponseString() =
    default;

DirectFromSellerSignalsRequester::Result::Result(
    GURL signals_url,
    std::unique_ptr<std::string> response_body,
    scoped_refptr<net::HttpResponseHeaders> headers,
    std::optional<std::string> error)
    :{}

DirectFromSellerSignalsRequester::Result::Result(const Result&) = default;

DirectFromSellerSignalsRequester::Result&
DirectFromSellerSignalsRequester::Result::operator=(const Result&) = default;

DirectFromSellerSignalsRequester::Request::~Request() {}

DirectFromSellerSignalsRequester::Request::Request(
    DirectFromSellerSignalsRequesterCallback callback,
    DirectFromSellerSignalsRequester& requester,
    const GURL& signals_url)
    :{}

void DirectFromSellerSignalsRequester::Request::RunCallbackSync(Result result) {}

void DirectFromSellerSignalsRequester::Request::RunCallbackAsync(
    Result result) {}

DirectFromSellerSignalsRequester::DirectFromSellerSignalsRequester() = default;

DirectFromSellerSignalsRequester::~DirectFromSellerSignalsRequester() {}

std::unique_ptr<DirectFromSellerSignalsRequester::Request>
DirectFromSellerSignalsRequester::LoadSignals(
    network::mojom::URLLoaderFactory& url_loader_factory,
    const GURL& signals_url,
    DirectFromSellerSignalsRequesterCallback callback) {}

DirectFromSellerSignalsRequester::CoalescedDownload::CoalescedDownload(
    std::unique_ptr<AuctionDownloader> downloader)
    :{}

DirectFromSellerSignalsRequester::CoalescedDownload::~CoalescedDownload() {}

DirectFromSellerSignalsRequester::CoalescedDownload::CoalescedDownload(
    CoalescedDownload&&) = default;

DirectFromSellerSignalsRequester::CoalescedDownload&
DirectFromSellerSignalsRequester::CoalescedDownload::operator=(
    CoalescedDownload&&) = default;

void DirectFromSellerSignalsRequester::OnSignalsDownloaded(
    GURL signals_url,
    base::TimeTicks start_time,
    std::unique_ptr<std::string> response_body,
    scoped_refptr<net::HttpResponseHeaders> headers,
    std::optional<std::string> error) {}

void DirectFromSellerSignalsRequester::OnRequestDestroyed(Request& request) {}

}  // namespace auction_worklet