chromium/components/history/core/browser/history_types.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "components/history/core/browser/history_types.h"

#include <limits>

#include "base/check.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "components/history/core/browser/page_usage_data.h"

namespace history {

namespace {

static constexpr float kScoreEpsilon =;

}  // namespace

// VisitRow --------------------------------------------------------------------

VisitRow::VisitRow() = default;

VisitRow::VisitRow(URLID arg_url_id,
                   base::Time arg_visit_time,
                   VisitID arg_referring_visit,
                   ui::PageTransition arg_transition,
                   SegmentID arg_segment_id,
                   bool arg_incremented_omnibox_typed_score,
                   VisitID arg_opener_visit)
    :{}

VisitRow::~VisitRow() = default;

VisitRow::VisitRow(const VisitRow&) = default;

// VisitedLinkRow --------------------------------------------------------------

bool operator==(const VisitedLinkRow& lhs, const VisitedLinkRow& rhs) {}

bool operator!=(const VisitedLinkRow& lhs, const VisitedLinkRow& rhs) {}

bool operator<(const VisitedLinkRow& lhs, const VisitedLinkRow& rhs) {}

// QueryResults ----------------------------------------------------------------

QueryResults::QueryResults() = default;

QueryResults::~QueryResults() = default;

QueryResults::QueryResults(QueryResults&& other) noexcept {}

QueryResults& QueryResults::operator=(QueryResults&& other) noexcept {}

const size_t* QueryResults::MatchesForURL(const GURL& url,
                                          size_t* num_matches) const {}

void QueryResults::Swap(QueryResults* other) {}

void QueryResults::SetURLResults(std::vector<URLResult>&& results) {}

void QueryResults::DeleteURL(const GURL& url) {}

void QueryResults::DeleteRange(size_t begin, size_t end) {}

void QueryResults::AddURLUsageAtIndex(const GURL& url, size_t index) {}

void QueryResults::AdjustResultMap(size_t begin, size_t end, ptrdiff_t delta) {}

// QueryOptions ----------------------------------------------------------------

QueryOptions::QueryOptions() = default;

QueryOptions::~QueryOptions() = default;

QueryOptions::QueryOptions(const QueryOptions&) = default;

QueryOptions::QueryOptions(QueryOptions&&) noexcept = default;

QueryOptions& QueryOptions::operator=(const QueryOptions&) = default;

QueryOptions& QueryOptions::operator=(QueryOptions&&) noexcept = default;

void QueryOptions::SetRecentDayRange(int days_ago) {}

int64_t QueryOptions::EffectiveBeginTime() const {}

int64_t QueryOptions::EffectiveEndTime() const {}

int QueryOptions::EffectiveMaxCount() const {}

// QueryURLResult -------------------------------------------------------------

QueryURLResult::QueryURLResult() = default;

QueryURLResult::~QueryURLResult() = default;

QueryURLResult::QueryURLResult(const QueryURLResult&) = default;

QueryURLResult::QueryURLResult(QueryURLResult&&) noexcept = default;

QueryURLResult& QueryURLResult::operator=(const QueryURLResult&) = default;

QueryURLResult& QueryURLResult::operator=(QueryURLResult&&) noexcept = default;

// MostVisitedURL --------------------------------------------------------------

MostVisitedURL::MostVisitedURL() = default;

MostVisitedURL::MostVisitedURL(const GURL& url, const std::u16string& title)
    :{}

MostVisitedURL::MostVisitedURL(const MostVisitedURL& other) = default;

MostVisitedURL::MostVisitedURL(MostVisitedURL&& other) noexcept = default;

MostVisitedURL::~MostVisitedURL() = default;

MostVisitedURL& MostVisitedURL::operator=(const MostVisitedURL&) = default;

// FilteredURL -----------------------------------------------------------------

FilteredURL::FilteredURL() = default;

FilteredURL::FilteredURL(const PageUsageData& page_data)
    :{}

FilteredURL::FilteredURL(FilteredURL&& other) noexcept = default;

FilteredURL::~FilteredURL() = default;

// FilteredURL::ExtendedInfo ---------------------------------------------------

FilteredURL::ExtendedInfo::ExtendedInfo() = default;

// GetAllAppIdsResult -------------------------------------------------------

GetAllAppIdsResult::GetAllAppIdsResult() = default;

GetAllAppIdsResult::GetAllAppIdsResult(GetAllAppIdsResult&& other) = default;

GetAllAppIdsResult& GetAllAppIdsResult::operator=(GetAllAppIdsResult&& other) =
    default;

GetAllAppIdsResult::~GetAllAppIdsResult() = default;

// DomainsVisitedResult -------------------------------------------------------

DomainsVisitedResult::DomainsVisitedResult() = default;

DomainsVisitedResult::DomainsVisitedResult(DomainsVisitedResult&& other) =
    default;

DomainsVisitedResult& DomainsVisitedResult::operator=(
    DomainsVisitedResult&& other) = default;

DomainsVisitedResult::~DomainsVisitedResult() = default;

// TopSitesDelta --------------------------------------------------------------

TopSitesDelta::TopSitesDelta() = default;

TopSitesDelta::TopSitesDelta(const TopSitesDelta& other) = default;

TopSitesDelta::~TopSitesDelta() = default;

// Opener
// -----------------------------------------------------------------------

Opener::Opener() :{}

Opener::Opener(ContextID context_id, int nav_entry_id, const GURL& url)
    :{}

Opener::Opener(const Opener& other) = default;

Opener::~Opener() = default;

// HistoryAddPageArgs ---------------------------------------------------------

HistoryAddPageArgs::HistoryAddPageArgs()
    :{}

HistoryAddPageArgs::HistoryAddPageArgs(
    const GURL& url,
    base::Time time,
    ContextID context_id,
    int nav_entry_id,
    std::optional<int64_t> local_navigation_id,
    const GURL& referrer,
    const RedirectList& redirects,
    ui::PageTransition transition,
    bool hidden,
    VisitSource source,
    bool did_replace_entry,
    bool consider_for_ntp_most_visited,
    std::optional<std::u16string> title,
    std::optional<GURL> top_level_url,
    std::optional<Opener> opener,
    std::optional<int64_t> bookmark_id,
    std::optional<std::string> app_id,
    std::optional<VisitContextAnnotations::OnVisitFields> context_annotations)
    :{}

HistoryAddPageArgs::HistoryAddPageArgs(const HistoryAddPageArgs& other) =
    default;

HistoryAddPageArgs::~HistoryAddPageArgs() = default;

// DomainMetricSet ------------------------------------------------------------

DomainMetricSet::DomainMetricSet() = default;
DomainMetricSet::DomainMetricSet(const DomainMetricSet&) = default;
DomainMetricSet::~DomainMetricSet() = default;
DomainMetricSet& DomainMetricSet::operator=(const DomainMetricSet&) = default;

// ExpireHistoryArgs ----------------------------------------------------------

ExpireHistoryArgs::ExpireHistoryArgs() = default;

ExpireHistoryArgs::ExpireHistoryArgs(const ExpireHistoryArgs& other) = default;

ExpireHistoryArgs::~ExpireHistoryArgs() = default;

void ExpireHistoryArgs::SetTimeRangeForOneDay(base::Time time) {}

// DeletionTimeRange ----------------------------------------------------------

DeletionTimeRange DeletionTimeRange::Invalid() {}

DeletionTimeRange DeletionTimeRange::AllTime() {}

bool DeletionTimeRange::IsValid() const {}

bool DeletionTimeRange::IsAllTime() const {}

// DeletionInfo
// ----------------------------------------------------------

// static
DeletionInfo DeletionInfo::ForAllHistory() {}

// static
DeletionInfo DeletionInfo::ForUrls(URLRows deleted_rows,
                                   std::set<GURL> favicon_urls) {}

DeletionInfo::DeletionInfo(const DeletionTimeRange& time_range,
                           bool is_from_expiration,
                           URLRows deleted_rows,
                           std::set<GURL> favicon_urls,
                           std::optional<std::set<GURL>> restrict_urls)
    :{}

DeletionInfo::DeletionInfo(const DeletionTimeRange& time_range,
                           bool is_from_expiration,
                           Reason deletion_reason,
                           URLRows deleted_rows,
                           std::set<VisitID> deleted_visit_ids,
                           std::set<GURL> favicon_urls,
                           std::optional<std::set<GURL>> restrict_urls)
    :{}

DeletionInfo::~DeletionInfo() = default;

DeletionInfo::DeletionInfo(DeletionInfo&& other) noexcept = default;

DeletionInfo& DeletionInfo::operator=(DeletionInfo&& rhs) noexcept = default;

// DeletedVisit ----------------------------------------------------------------

DeletedVisit::DeletedVisit(VisitRow visit)
    :{}

DeletedVisit::DeletedVisit(VisitRow visit,
                           DeletedVisitedLink deleted_visited_link)
    :{}

DeletedVisit::DeletedVisit(const DeletedVisit& other) = default;
DeletedVisit& DeletedVisit::operator=(const DeletedVisit& other) = default;

DeletedVisit::~DeletedVisit() = default;

// Clusters --------------------------------------------------------------------

VisitContextAnnotations::VisitContextAnnotations() = default;

VisitContextAnnotations::VisitContextAnnotations(
    const VisitContextAnnotations& other) = default;

VisitContextAnnotations::~VisitContextAnnotations() = default;

bool VisitContextAnnotations::operator==(
    const VisitContextAnnotations& other) const {}

bool VisitContextAnnotations::operator!=(
    const VisitContextAnnotations& other) const {}

bool VisitContextAnnotations::OnVisitFields::operator==(
    const VisitContextAnnotations::OnVisitFields& other) const {}

bool VisitContextAnnotations::OnVisitFields::operator!=(
    const VisitContextAnnotations::OnVisitFields& other) const {}

AnnotatedVisit::AnnotatedVisit() = default;
AnnotatedVisit::AnnotatedVisit(URLRow url_row,
                               VisitRow visit_row,
                               VisitContextAnnotations context_annotations,
                               VisitContentAnnotations content_annotations,
                               VisitID referring_visit_of_redirect_chain_start,
                               VisitID opener_visit_of_redirect_chain_start,
                               VisitSource source)
    :{}
AnnotatedVisit::AnnotatedVisit(const AnnotatedVisit&) = default;
AnnotatedVisit::AnnotatedVisit(AnnotatedVisit&&) = default;
AnnotatedVisit& AnnotatedVisit::operator=(const AnnotatedVisit&) = default;
AnnotatedVisit& AnnotatedVisit::operator=(AnnotatedVisit&&) = default;
AnnotatedVisit::~AnnotatedVisit() = default;

// static
int ClusterVisit::InteractionStateToInt(ClusterVisit::InteractionState state) {}

ClusterVisit::ClusterVisit() = default;
ClusterVisit::~ClusterVisit() = default;
ClusterVisit::ClusterVisit(const ClusterVisit&) = default;
ClusterVisit::ClusterVisit(ClusterVisit&&) = default;
ClusterVisit& ClusterVisit::operator=(const ClusterVisit&) = default;
ClusterVisit& ClusterVisit::operator=(ClusterVisit&&) = default;

ClusterKeywordData::ClusterKeywordData() = default;
ClusterKeywordData::ClusterKeywordData(
    ClusterKeywordData::ClusterKeywordType type,
    float score)
    :{}
ClusterKeywordData::ClusterKeywordData(const ClusterKeywordData&) = default;
ClusterKeywordData::ClusterKeywordData(ClusterKeywordData&&) = default;
ClusterKeywordData& ClusterKeywordData::operator=(const ClusterKeywordData&) =
    default;
ClusterKeywordData& ClusterKeywordData::operator=(ClusterKeywordData&&) =
    default;
ClusterKeywordData::~ClusterKeywordData() = default;

bool ClusterKeywordData::operator==(const ClusterKeywordData& data) const {}

std::string ClusterKeywordData::ToString() const {}

std::ostream& operator<<(std::ostream& out, const ClusterKeywordData& data) {}

void ClusterKeywordData::MaybeUpdateKeywordType(
    ClusterKeywordData::ClusterKeywordType other_type) {}

std::string ClusterKeywordData::GetKeywordTypeLabel() const {}

Cluster::Cluster() = default;
Cluster::Cluster(int64_t cluster_id,
                 const std::vector<ClusterVisit>& visits,
                 const base::flat_map<std::u16string, ClusterKeywordData>&
                     keyword_to_data_map,
                 bool should_show_on_prominent_ui_surfaces,
                 std::optional<std::u16string> label,
                 std::optional<std::u16string> raw_label,
                 query_parser::Snippet::MatchPositions label_match_positions,
                 std::vector<std::string> related_searches,
                 float search_match_score)
    :{}
Cluster::Cluster(const Cluster&) = default;
Cluster::Cluster(Cluster&&) = default;
Cluster& Cluster::operator=(const Cluster&) = default;
Cluster& Cluster::operator=(Cluster&&) = default;
Cluster::~Cluster() = default;

const ClusterVisit& Cluster::GetMostRecentVisit() const {}

std::vector<std::u16string> Cluster::GetKeywords() const {}

}  // namespace history