chromium/components/safe_browsing/core/browser/db/v4_database.cc

// Copyright 2016 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/safe_browsing/core/browser/db/v4_database.h"

#include <memory>
#include <utility>

#include "base/debug/crash_logging.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/lazy_instance.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/proto/webui.pb.h"

#if BUILDFLAG(IS_APPLE)
#include "base/apple/backup_util.h"
#endif

TimeTicks;

namespace safe_browsing {

namespace {

const char kV4DatabaseSizeMetric[] =;
const char kV4DatabaseSizeLinearMetric[] =;
const char kV4DatabaseUpdateLatency[] =;
constexpr base::TimeDelta kUmaMinTime =;
constexpr base::TimeDelta kUmaMaxTime =;
constexpr int kUmaNumBuckets =;

// The factory that controls the creation of the V4Database object.
base::LazyInstance<std::unique_ptr<V4DatabaseFactory>>::Leaky g_db_factory =;

// The factory that controls the creation of V4Store objects.
base::LazyInstance<std::unique_ptr<V4StoreFactory>>::Leaky g_store_factory =;

// Verifies the checksums on a collection of stores.
// Returns the IDs of stores whose checksums failed to verify.
std::vector<ListIdentifier> VerifyChecksums(
    std::vector<std::pair<ListIdentifier, V4Store*>> stores) {}

// Returns hash prefixes matching the collection of stores.
FullHashToStoreAndHashPrefixesMap CheckStores(
    const std::vector<FullHashStr>& full_hashes,
    std::vector<std::pair<ListIdentifier, V4Store*>> stores) {}

}  // namespace

std::unique_ptr<V4Database, base::OnTaskRunnerDeleter>
V4DatabaseFactory::Create(
    const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
    std::unique_ptr<StoreMap> store_map) {}

// static
void V4Database::Create(
    const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
    const base::FilePath& base_path,
    const ListInfos& list_infos,
    NewDatabaseReadyCallback new_db_callback) {}

// static
void V4Database::CreateOnTaskRunner(
    const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
    const base::FilePath& base_path,
    const ListInfos& list_infos,
    const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner,
    NewDatabaseReadyCallback new_db_callback) {}

// static
void V4Database::RegisterDatabaseFactoryForTest(
    std::unique_ptr<V4DatabaseFactory> factory) {}

// static
void V4Database::RegisterStoreFactoryForTest(
    std::unique_ptr<V4StoreFactory> factory) {}

V4Database::V4Database(
    const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
    std::unique_ptr<StoreMap> store_map)
    :{}

void V4Database::InitializeOnUIThread() {}

void V4Database::StopOnUIThread() {}

V4Database::~V4Database() {}

void V4Database::ApplyUpdate(
    std::unique_ptr<ParsedServerResponse> parsed_server_response,
    DatabaseUpdatedCallback db_updated_callback) {}

void V4Database::UpdatedStoreReady(ListIdentifier identifier,
                                   V4StorePtr new_store) {}

std::unique_ptr<StoreStateMap> V4Database::GetStoreStateMap() {}

bool V4Database::AreAnyStoresAvailable(
    const StoresToCheck& stores_to_check) const {}

bool V4Database::AreAllStoresAvailable(
    const StoresToCheck& stores_to_check) const {}

void V4Database::GetStoresMatchingFullHash(
    const std::vector<FullHashStr>& full_hashes,
    const StoresToCheck& stores_to_check,
    base::OnceCallback<void(FullHashToStoreAndHashPrefixesMap)> callback) {}

void V4Database::ResetStores(
    const std::vector<ListIdentifier>& stores_to_reset) {}

void V4Database::VerifyChecksum(
    DatabaseReadyForUpdatesCallback db_ready_for_updates_callback) {}

void V4Database::OnChecksumVerified(
    DatabaseReadyForUpdatesCallback db_ready_for_updates_callback,
    const std::vector<ListIdentifier>& stores_to_reset) {}

bool V4Database::IsStoreAvailable(const ListIdentifier& identifier) const {}

int64_t V4Database::GetStoreSizeInBytes(
    const ListIdentifier& identifier) const {}

void V4Database::RecordFileSizeHistograms() {}

HashPrefixMap::MigrateResult V4Database::GetMigrateResult() {}

void V4Database::RecordDatabaseUpdateLatency() {}

void V4Database::CollectDatabaseInfo(
    DatabaseManagerInfo::DatabaseInfo* database_info) {}

ListInfo::ListInfo(const bool fetch_updates,
                   const std::string& filename,
                   const ListIdentifier& list_id,
                   const SBThreatType sb_threat_type)
    :{}

ListInfo::~ListInfo() {}

}  // namespace safe_browsing