#include "tools/aggregation_service/aggregation_service_tool.h"
#include <functional>
#include <string>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
#include "base/run_loop.h"
#include "base/strings/abseil_string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/default_clock.h"
#include "base/values.h"
#include "build/build_config.h"
#include "content/public/test/test_aggregation_service.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "third_party/abseil-cpp/absl/numeric/int128.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace aggregation_service {
namespace {
std::optional<content::TestAggregationService::Operation> ConvertToOperation(
std::string_view operation_string) { … }
std::optional<content::TestAggregationService::AggregationMode>
ConvertToAggregationMode(std::string_view aggregation_mode_string) { … }
}
UrlKeyFile::UrlKeyFile(GURL url, std::string key_file)
: … { … }
UrlKeyFile::UrlKeyFile(const UrlKeyFile& other) = default;
UrlKeyFile& UrlKeyFile::operator=(const UrlKeyFile& other) = default;
UrlKeyFile::~UrlKeyFile() = default;
AggregationServiceTool::AggregationServiceTool()
: … { … }
AggregationServiceTool::~AggregationServiceTool() = default;
void AggregationServiceTool::SetDisablePayloadEncryption(bool should_disable) { … }
bool AggregationServiceTool::SetPublicKeys(
const std::vector<UrlKeyFile>& key_files) { … }
bool AggregationServiceTool::SetPublicKeysFromFile(
const GURL& url,
std::string_view json_file_path) { … }
base::Value::Dict AggregationServiceTool::AssembleReport(
std::string operation_str,
std::string bucket_str,
std::string value_str,
std::string aggregation_mode_str,
url::Origin reporting_origin,
std::vector<GURL> processing_urls,
bool is_debug_mode_enabled,
base::Value::Dict additional_fields,
std::string api_version,
std::string api_identifier) { … }
bool AggregationServiceTool::SendReport(const base::Value& contents,
const GURL& url) { … }
bool AggregationServiceTool::WriteReportToFile(const base::Value& contents,
const base::FilePath& filename) { … }
}