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

// Copyright 2021 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/history/core/browser/visit_annotations_database.h"

#include <string>
#include <vector>

#include "base/logging.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "components/history/core/browser/history_types.h"
#include "components/history/core/browser/url_row.h"
#include "sql/statement.h"
#include "sql/statement_id.h"
#include "sql/transaction.h"

namespace history {

namespace {

#define HISTORY_CONTENT_ANNOTATIONS_ROW_FIELDS
#define HISTORY_CONTEXT_ANNOTATIONS_ROW_FIELDS
#define HISTORY_CLUSTER_ROW_FIELDS
#define HISTORY_CLUSTER_VISIT_ROW_FIELDS

VisitContextAnnotations::BrowserType BrowserTypeFromInt(int type) {}

int BrowserTypeToInt(VisitContextAnnotations::BrowserType type) {}

VisitContentAnnotations::PasswordState PasswordStateFromInt(int state) {}

int PasswordStateToInt(VisitContentAnnotations::PasswordState state) {}

// An enum of bitmasks to help represent the boolean flags of
// `VisitContextAnnotations` in the database. This avoids having to update
// the schema every time we add/remove/change a bool context annotation. As
// these are persisted to the database, entries should not be renumbered and
// numeric values should never be reused.
enum class ContextAnnotationFlags : uint64_t {};

int64_t ContextAnnotationsToFlags(VisitContextAnnotations context_annotations) {}

VisitContextAnnotations ConstructContextAnnotationsWithFlags(
    int64_t flags,
    base::TimeDelta duration_since_last_visit,
    int page_end_reason,
    base::TimeDelta total_foreground_duration,
    int browser_type,
    SessionID window_id,
    SessionID tab_id,
    int64_t task_id,
    int64_t root_task_id,
    int64_t parent_task_id,
    int response_code) {}

ClusterVisit::InteractionState InteractionStateFromInt(int state) {}

}  // namespace

VisitAnnotationsDatabase::VisitAnnotationsDatabase() = default;
VisitAnnotationsDatabase::~VisitAnnotationsDatabase() = default;

bool VisitAnnotationsDatabase::InitVisitAnnotationsTables() {}

bool VisitAnnotationsDatabase::DropVisitAnnotationsTables() {}

void VisitAnnotationsDatabase::AddContentAnnotationsForVisit(
    VisitID visit_id,
    const VisitContentAnnotations& visit_content_annotations) {}

void VisitAnnotationsDatabase::AddContextAnnotationsForVisit(
    VisitID visit_id,
    const VisitContextAnnotations& visit_context_annotations) {}

void VisitAnnotationsDatabase::UpdateContentAnnotationsForVisit(
    VisitID visit_id,
    const VisitContentAnnotations& visit_content_annotations) {}

void VisitAnnotationsDatabase::UpdateContextAnnotationsForVisit(
    VisitID visit_id,
    const VisitContextAnnotations& visit_context_annotations) {}

bool VisitAnnotationsDatabase::GetContextAnnotationsForVisit(
    VisitID visit_id,
    VisitContextAnnotations* out_context_annotations) {}

bool VisitAnnotationsDatabase::GetContentAnnotationsForVisit(
    VisitID visit_id,
    VisitContentAnnotations* out_content_annotations) {}

void VisitAnnotationsDatabase::DeleteAnnotationsForVisit(VisitID visit_id) {}

void VisitAnnotationsDatabase::AddClusters(
    const std::vector<Cluster>& clusters) {}

int64_t VisitAnnotationsDatabase::ReserveNextClusterId(
    const std::string& originator_cache_guid,
    int64_t originator_cluster_id) {}

void VisitAnnotationsDatabase::AddVisitsToCluster(
    int64_t cluster_id,
    const std::vector<ClusterVisit>& visits) {}

void VisitAnnotationsDatabase::UpdateClusterTriggerability(
    const std::vector<history::Cluster>& clusters) {}

void VisitAnnotationsDatabase::UpdateClusterVisit(
    int64_t cluster_id,
    const history::ClusterVisit& cluster_visit) {}

Cluster VisitAnnotationsDatabase::GetCluster(int64_t cluster_id) {}

std::vector<int64_t> VisitAnnotationsDatabase::GetMostRecentClusterIds(
    base::Time inclusive_min_time,
    base::Time exclusive_max_time,
    int max_clusters) {}

std::vector<VisitID> VisitAnnotationsDatabase::GetVisitIdsInCluster(
    int64_t cluster_id) {}

ClusterVisit VisitAnnotationsDatabase::GetClusterVisit(VisitID visit_id) {}

std::vector<VisitID>
VisitAnnotationsDatabase::GetDuplicateClusterVisitIdsForClusterVisit(
    int64_t visit_id) {}

int64_t VisitAnnotationsDatabase::GetClusterIdContainingVisit(
    VisitID visit_id) {}

int64_t VisitAnnotationsDatabase::GetClusterIdForSyncedDetails(
    const std::string& originator_cache_guid,
    int64_t originator_cluster_id) {}

base::flat_map<std::u16string, ClusterKeywordData>
VisitAnnotationsDatabase::GetClusterKeywords(int64_t cluster_id) {}

void VisitAnnotationsDatabase::HideVisits(
    const std::vector<VisitID>& visit_ids) {}

void VisitAnnotationsDatabase::DeleteClusters(
    const std::vector<int64_t>& cluster_ids) {}

void VisitAnnotationsDatabase::UpdateVisitsInteractionState(
    const std::vector<VisitID>& visit_ids,
    ClusterVisit::InteractionState interaction_state) {}

bool VisitAnnotationsDatabase::MigrateFlocAllowedToAnnotationsTable() {}

bool VisitAnnotationsDatabase::MigrateReplaceClusterVisitsTable() {}

bool VisitAnnotationsDatabase::
    MigrateContentAnnotationsWithoutEntitiesColumn() {}

bool VisitAnnotationsDatabase::
    MigrateContentAnnotationsAddRelatedSearchesColumn() {}

bool VisitAnnotationsDatabase::MigrateContentAnnotationsAddVisibilityScore() {}

bool VisitAnnotationsDatabase::
    MigrateContextAnnotationsAddTotalForegroundDuration() {}

bool VisitAnnotationsDatabase::MigrateContentAnnotationsAddSearchMetadata() {}

bool VisitAnnotationsDatabase::MigrateContentAnnotationsAddAlternativeTitle() {}

bool VisitAnnotationsDatabase::MigrateClustersAddColumns() {}

bool VisitAnnotationsDatabase::MigrateAnnotationsAddColumnsForSync() {}

bool VisitAnnotationsDatabase::MigrateClustersAddTriggerabilityCalculated() {}

bool VisitAnnotationsDatabase::
    MigrateClustersAutoincrementIdAndAddOriginatorColumns() {}

bool VisitAnnotationsDatabase::ClustersTableContainsAutoincrement() {}

bool VisitAnnotationsDatabase::MigrateContentAnnotationsAddHasUrlKeyedImage() {}

bool VisitAnnotationsDatabase::MigrateClustersAndVisitsAddInteractionState() {}

bool VisitAnnotationsDatabase::CreateClustersTable() {}

bool VisitAnnotationsDatabase::CreateClustersAndVisitsTableAndIndex() {}

// Converts categories to something that can be stored in the database. As the
// serialized format is already being synced, the implementation of these
// functions should not be changed.
std::string VisitAnnotationsDatabase::ConvertCategoriesToStringColumn(
    const std::vector<VisitContentModelAnnotations::Category>& categories) {}

// Converts serialized categories into a vector of (`id`, `weight`) pairs. As
// the serialized format is already being synced, the implementation of these
// functions should not be changed.
std::vector<VisitContentModelAnnotations::Category>
VisitAnnotationsDatabase::GetCategoriesFromStringColumn(
    const std::string& column_value) {}

// Serializes a vector of strings into a string that can be stored in the db.
// As the serialized format is already being synced, the implementation of
// these functions should not be changed.
std::string VisitAnnotationsDatabase::SerializeToStringColumn(
    const std::vector<std::string>& related_searches) {}

// Converts a serialized db string into a vector of strings. As the serialized
// format is already being synced, the implementation of these functions
// should not be changed.
std::vector<std::string> VisitAnnotationsDatabase::DeserializeFromStringColumn(
    const std::string& column_value) {}

}  // namespace history