chromium/third_party/blink/common/interest_group/devtools_serialization.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 "third_party/blink/public/common/interest_group/devtools_serialization.h"

#include <cmath>
#include <string_view>
#include <tuple>

#include "base/base64.h"
#include "base/strings/to_string.h"
#include "base/values.h"
#include "third_party/blink/public/common/interest_group/ad_display_size_utils.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/ad_auction_service.mojom.h"

namespace blink {

namespace {

std::string SerializeIntoKey(const url::Origin& in) {}

std::string SerializeIntoKey(const std::string& in) {}

BuyerReportType;
std::string SerializeIntoKey(BuyerReportType report_type) {}

RealTimeReportingType;
std::string SerializeIntoValue(RealTimeReportingType report_type) {}

template <typename T>
base::Value SerializeIntoValue(const T& in) {}

// Forward declare for mutual recursion.
template <typename K, typename V>
base::Value SerializeIntoValue(const base::flat_map<K, V>&);

template <typename T>
void SerializeIntoDict(std::string_view field,
                       const T& value,
                       base::Value::Dict& out);

template <typename T>
void SerializeIntoDict(std::string_view field,
                       const std::optional<T>& value,
                       base::Value::Dict& out);

template <typename T>
base::Value SerializeIntoValue(const std::optional<T>& value) {}

template <>
base::Value SerializeIntoValue(const url::Origin& value) {}

template <>
base::Value SerializeIntoValue(const GURL& value) {}

template <>
base::Value SerializeIntoValue(const base::TimeDelta& value) {}

template <>
base::Value SerializeIntoValue(const absl::uint128& value) {}

template <>
base::Value SerializeIntoValue(
    const blink::AuctionConfig::AdKeywordReplacement& value) {}

template <>
base::Value SerializeIntoValue(const double& value) {}

template <>
base::Value SerializeIntoValue(
    const AuctionConfig::NonSharedParams::AuctionReportBuyersConfig& value) {}

template <>
base::Value SerializeIntoValue(const SellerCapabilitiesType& value) {}

template <>
base::Value SerializeIntoValue(const base::Uuid& uuid) {}

template <>
base::Value SerializeIntoValue(
    const blink::AuctionConfig::ServerResponseConfig& server_config) {}

template <typename T>
base::Value SerializeIntoValue(const std::vector<T>& values) {}

template <typename T>
base::Value SerializeIntoValue(const AuctionConfig::MaybePromise<T>& promise) {}

template <>
base::Value SerializeIntoValue(
    const AuctionConfig::NonSharedParams::AuctionReportBuyerDebugModeConfig&
        value) {}

template <typename K, typename V>
base::Value SerializeIntoValue(const base::flat_map<K, V>& value) {}

// Helper to put the split out all_/'*' value back into a single map.
// Annoyingly we are quite inconsistent about how optional is used. This handles
// both cases for the map; for the value the caller can just use make_optional.
template <typename T>
base::Value::Dict SerializeSplitMapHelper(
    const std::optional<T>& all_value,
    const std::optional<base::flat_map<url::Origin, T>>& per_values) {}

template <typename T>
base::Value::Dict SerializeSplitMapHelper(
    const std::optional<T>& all_value,
    const base::flat_map<url::Origin, T>& per_values) {}

template <>
base::Value SerializeIntoValue(const AuctionConfig::BuyerTimeouts& in) {}

template <>
base::Value SerializeIntoValue(const AuctionConfig::BuyerCurrencies& in) {}

template <>
base::Value SerializeIntoValue(const AdCurrency& in) {}

template <>
base::Value SerializeIntoValue(const AdSize& ad_size) {}

template <>
base::Value SerializeIntoValue(
    const blink::mojom::InterestGroup::ExecutionMode& in) {}

template <>
base::Value SerializeIntoValue(const InterestGroup::AdditionalBidKey& in) {}

template <>
base::Value SerializeIntoValue(const InterestGroup::Ad& ad) {}

template <>
base::Value SerializeIntoValue(const AuctionServerRequestFlags& flags) {}

template <typename T>
void SerializeIntoDict(std::string_view field,
                       const T& value,
                       base::Value::Dict& out) {}

// Unlike the value serializer this just makes the field not set, rather than
// explicitly null.
template <typename T>
void SerializeIntoDict(std::string_view field,
                       const std::optional<T>& value,
                       base::Value::Dict& out) {}

// For use with SerializeSplitMapHelper.
void SerializeIntoDict(std::string_view field,
                       base::Value::Dict value,
                       base::Value::Dict& out) {}

}  // namespace

base::Value::Dict SerializeAuctionConfigForDevtools(const AuctionConfig& conf) {}

base::Value::Dict SerializeInterestGroupForDevtools(const InterestGroup& ig) {}

}  // namespace blink