chromium/chrome/browser/k_anonymity_service/k_anonymity_service_client.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 "chrome/browser/k_anonymity_service/k_anonymity_service_client.h"

#include "base/base64.h"
#include "base/base64url.h"
#include "base/feature_list.h"
#include "base/functional/callback.h"
#include "base/json/json_writer.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/types/expected.h"
#include "chrome/browser/k_anonymity_service/k_anonymity_service_metrics.h"
#include "chrome/browser/k_anonymity_service/k_anonymity_service_urls.h"
#include "chrome/browser/k_anonymity_service/remote_trust_token_query_answerer.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/common/chrome_features.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/tribool.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "google_apis/gaia/gaia_constants.h"
#include "google_apis/google_api_keys.h"
#include "net/base/isolation_info.h"
#include "net/base/load_flags.h"
#include "net/http/http_status_code.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/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/oblivious_http_request.mojom.h"
#include "services/network/public/mojom/trust_tokens.mojom.h"

namespace {

constexpr base::TimeDelta kRequestTimeout =;
constexpr base::TimeDelta kRequestMargin =;
constexpr base::TimeDelta kKeyCacheDuration =;
constexpr int kMaxRetries =;
constexpr size_t kMaxQueueSize =;

// TODO(behamilton): Allow the KAnonType to be specified by the client.
const char kKAnonType[] =;
const char kKAnonymityServiceStoragePath[] =;

constexpr net::NetworkTrafficAnnotationTag
    kKAnonymityServiceJoinSetTrafficAnnotation =;

constexpr net::NetworkTrafficAnnotationTag
    kKAnonymityServiceQuerySetTrafficAnnotation =;

// KAnonObliviousHttpClient accepts OnCompleted calls and forwards them to the
// provided callback. It also calls the callback if it is destroyed before the
// callback is called.
class KAnonObliviousHttpClient : public network::mojom::ObliviousHttpClient {};

}  // namespace

KAnonymityServiceClient::PendingJoinRequest::PendingJoinRequest(
    std::string set_id,
    base::OnceCallback<void(bool)> callback)
    :{}

KAnonymityServiceClient::PendingJoinRequest::~PendingJoinRequest() = default;

KAnonymityServiceClient::PendingQueryRequest::PendingQueryRequest(
    std::vector<std::string> set_ids,
    base::OnceCallback<void(std::vector<bool>)> callback)
    :{}

KAnonymityServiceClient::PendingQueryRequest::~PendingQueryRequest() = default;

KAnonymityServiceClient::KAnonymityServiceClient(Profile* profile)
    :{}

KAnonymityServiceClient::~KAnonymityServiceClient() = default;

bool KAnonymityServiceClient::CanUseKAnonymityService(Profile* profile) {}

void KAnonymityServiceClient::JoinSet(std::string id,
                                      base::OnceCallback<void(bool)> callback) {}

void KAnonymityServiceClient::JoinSetOnStorageReady(
    KAnonymityServiceStorage::InitStatus status) {}

void KAnonymityServiceClient::JoinSetStartNextQueued() {}

void KAnonymityServiceClient::JoinSetCheckOHTTPKey() {}

void KAnonymityServiceClient::RequestJoinSetOHTTPKey() {}

void KAnonymityServiceClient::OnGotJoinSetOHTTPKey(
    std::unique_ptr<std::string> response) {}

void KAnonymityServiceClient::JoinSetCheckTrustTokens(
    OHTTPKeyAndExpiration ohttp_key) {}

void KAnonymityServiceClient::OnMaybeHasTrustTokens(
    OHTTPKeyAndExpiration ohttp_key,
    std::optional<KeyAndNonUniqueUserId> maybe_key_and_id) {}

void KAnonymityServiceClient::JoinSetSendRequest(
    OHTTPKeyAndExpiration ohttp_key,
    KeyAndNonUniqueUserId key_and_id) {}

void KAnonymityServiceClient::JoinSetOnGotResponse(
    const std::optional<std::string>& response,
    int error_code) {}

void KAnonymityServiceClient::FailJoinSetRequests() {}

void KAnonymityServiceClient::CompleteJoinSetRequest() {}

void KAnonymityServiceClient::DoJoinSetCallback(bool status) {}

void KAnonymityServiceClient::QuerySets(
    std::vector<std::string> set_ids,
    base::OnceCallback<void(std::vector<bool>)> callback) {}

void KAnonymityServiceClient::QuerySetsOnStorageReady(
    KAnonymityServiceStorage::InitStatus status) {}

void KAnonymityServiceClient::QuerySetsCheckOHTTPKey() {}

void KAnonymityServiceClient::RequestQuerySetOHTTPKey() {}

void KAnonymityServiceClient::OnGotQuerySetOHTTPKey(
    std::unique_ptr<std::string> response) {}

void KAnonymityServiceClient::QuerySetsSendRequest(
    OHTTPKeyAndExpiration ohttp_key) {}

void KAnonymityServiceClient::QuerySetsOnGotResponse(
    const std::optional<std::string>& response,
    int error_code) {}

void KAnonymityServiceClient::QuerySetsOnParsedResponse(
    data_decoder::DataDecoder::ValueOrError result) {}

void KAnonymityServiceClient::CompleteQuerySetsRequest(
    std::vector<bool> result) {}

void KAnonymityServiceClient::FailQuerySetsRequests() {}

void KAnonymityServiceClient::DoQuerySetsCallback(std::vector<bool> result) {}

base::TimeDelta KAnonymityServiceClient::GetJoinInterval() {}

base::TimeDelta KAnonymityServiceClient::GetQueryInterval() {}