#include "components/affiliations/core/browser/affiliation_database.h"
#include <stdint.h>
#include <memory>
#include <set>
#include <vector>
#include "base/containers/flat_set.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/parameter_pack.h"
#include "build/build_config.h"
#include "components/affiliations/core/browser/sql_table_builder.h"
#include "components/affiliations/core/browser/affiliation_utils.h"
#include "sql/database.h"
#include "sql/error_delegate_util.h"
#include "sql/meta_table.h"
#include "sql/statement.h"
#include "sql/transaction.h"
namespace affiliations {
namespace {
const int kVersion = …;
const int kCompatibleVersion = …;
struct SQLTableBuilders { … };
void SealVersion(SQLTableBuilders builders, unsigned expected_version) { … }
void InitializeTableBuilders(SQLTableBuilders builders) { … }
bool EnsureCurrentVersion(sql::Database* db,
unsigned version,
SQLTableBuilder* builder) { … }
}
AffiliationDatabase::AffiliationDatabase() = default;
AffiliationDatabase::~AffiliationDatabase() = default;
bool AffiliationDatabase::Init(const base::FilePath& path) { … }
bool AffiliationDatabase::GetAffiliationsAndBrandingForFacetURI(
const FacetURI& facet_uri,
AffiliatedFacetsWithUpdateTime* result) const { … }
void AffiliationDatabase::GetAllAffiliationsAndBranding(
std::vector<AffiliatedFacetsWithUpdateTime>* results) const { … }
std::vector<GroupedFacets> AffiliationDatabase::GetAllGroups() const { … }
GroupedFacets AffiliationDatabase::GetGroup(const FacetURI& facet_uri) const { … }
std::vector<std::string> AffiliationDatabase::GetPSLExtensions() const { … }
void AffiliationDatabase::DeleteAffiliationsAndBrandingForFacetURI(
const FacetURI& facet_uri) { … }
AffiliationDatabase::StoreAffiliationResult AffiliationDatabase::Store(
const AffiliatedFacetsWithUpdateTime& affiliated_facets,
const GroupedFacets& group) { … }
void AffiliationDatabase::StoreAndRemoveConflicting(
const AffiliatedFacetsWithUpdateTime& affiliation,
const GroupedFacets& group,
std::vector<AffiliatedFacetsWithUpdateTime>* removed_affiliations) { … }
void AffiliationDatabase::RemoveMissingFacetURI(
std::vector<FacetURI> facet_uris) { … }
void AffiliationDatabase::Delete(const base::FilePath& path) { … }
int AffiliationDatabase::GetDatabaseVersionForTesting() { … }
void AffiliationDatabase::UpdatePslExtensions(
const std::vector<std::string>& domains) { … }
void AffiliationDatabase::SQLErrorCallback(int error,
sql::Statement* statement) { … }
}