chromium/components/origin_trials/browser/origin_trials.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 "components/origin_trials/browser/origin_trials.h"

#include <algorithm>
#include <string_view>

#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "components/origin_trials/common/persisted_trial_token.h"
#include "net/base/schemeful_site.h"
#include "third_party/blink/public/common/origin_trials/origin_trials.h"
#include "third_party/blink/public/common/origin_trials/trial_token.h"
#include "third_party/blink/public/common/origin_trials/trial_token_result.h"
#include "third_party/blink/public/common/origin_trials/trial_token_validator.h"
#include "url/origin.h"

namespace origin_trials {

namespace {
// A string to denote opaque origins for partitioning. It should not be
// possible to have a valid origin serialize to this value.
const char kOpaqueOriginPartitionKey[] =;
}  // namespace

OriginTrials::OriginTrials(
    std::unique_ptr<OriginTrialsPersistenceProvider> persistence_provider,
    std::unique_ptr<blink::TrialTokenValidator> token_validator)
    :{}

OriginTrials::~OriginTrials() = default;

void OriginTrials::AddObserver(Observer* observer) {}

void OriginTrials::RemoveObserver(Observer* observer) {}

void OriginTrials::NotifyStatusChange(
    const std::string& trial,
    const OriginTrialStatusChangeDetails& details) {}

void OriginTrials::NotifyPersistedTokensCleared() {}

bool OriginTrials::MatchesTokenOrigin(const url::Origin& token_origin,
                                      bool match_subdomains,
                                      const url::Origin& origin) const {}

base::flat_set<std::string> OriginTrials::GetPersistedTrialsForOrigin(
    const url::Origin& origin,
    const url::Origin& partition_origin,
    const base::Time current_time) {}

bool OriginTrials::IsFeaturePersistedForOrigin(
    const url::Origin& origin,
    const url::Origin& partition_origin,
    blink::mojom::OriginTrialFeature feature,
    const base::Time current_time) {}

void OriginTrials::PersistTrialsFromTokens(
    const url::Origin& origin,
    const url::Origin& partition_origin,
    const base::span<const std::string> header_tokens,
    const base::Time current_time,
    std::optional<ukm::SourceId> source_id) {}

void OriginTrials::PersistAdditionalTrialsFromTokens(
    const url::Origin& origin,
    const url::Origin& partition_origin,
    base::span<const url::Origin> script_origins,
    const base::span<const std::string> header_tokens,
    const base::Time current_time,
    std::optional<ukm::SourceId> source_id) {}

void OriginTrials::PersistTokensInternal(
    const url::Origin& origin,
    const url::Origin& partition_origin,
    base::span<const url::Origin> script_origins,
    const base::span<const std::string> header_tokens,
    const base::Time current_time,
    std::optional<ukm::SourceId> source_id,
    bool append_only) {}

base::flat_set<std::string> OriginTrials::GetPersistedTrialsForOriginWithMatch(
    const url::Origin& origin,
    const url::Origin& partition_origin,
    const base::Time current_time,
    const std::optional<blink::mojom::OriginTrialFeature> trial_feature_match)
    const {}

void OriginTrials::ClearPersistedTokens() {}

// static
std::string OriginTrials::GetTokenPartitionSite(const url::Origin& origin) {}

void OriginTrials::UpdatePersistedTokenSet(
    const url::Origin& document_origin,
    const url::Origin& token_origin,
    base::span<const blink::TrialToken> new_tokens,
    const std::string& partition_site,
    std::optional<ukm::SourceId> source_id,
    bool append_only) {}

}  // namespace origin_trials