#include "components/autofill/core/browser/strike_databases/strike_database.h"
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "components/autofill/core/browser/proto/strike_data.pb.h"
#include "components/autofill/core/common/autofill_clock.h"
#include "components/leveldb_proto/public/proto_database_provider.h"
namespace autofill {
namespace {
const int kMaxInitAttempts = …;
}
const base::FilePath::StringPieceType kStrikeDatabaseFileName = …);
StrikeDatabase::StrikeDatabase(
leveldb_proto::ProtoDatabaseProvider* db_provider,
base::FilePath profile_path) { … }
StrikeDatabase::~StrikeDatabase() = default;
int StrikeDatabase::AddStrikes(int strikes_increase, const std::string& key) { … }
int StrikeDatabase::RemoveStrikes(int strikes_decrease,
const std::string& key) { … }
int StrikeDatabase::GetStrikes(const std::string& key) { … }
void StrikeDatabase::ClearStrikes(const std::string& key) { … }
std::map<std::string, StrikeData>& StrikeDatabase::GetStrikeCache() { … }
void StrikeDatabase::SetStrikeData(const std::string& key, int num_strikes) { … }
int64_t StrikeDatabase::GetLastUpdatedTimestamp(const std::string& key) { … }
std::vector<std::string> StrikeDatabase::GetAllStrikeKeysForProject(
const std::string& project_prefix) { … }
void StrikeDatabase::ClearAllStrikesForProject(
const std::string& project_prefix) { … }
void StrikeDatabase::ClearStrikesForKeys(
const std::vector<std::string>& keys_to_remove) { … }
void StrikeDatabase::ClearAllStrikes() { … }
std::string StrikeDatabase::GetPrefixFromKey(const std::string& key) const { … }
StrikeDatabase::StrikeDatabase() : … { … }
void StrikeDatabase::OnDatabaseInit(leveldb_proto::Enums::InitStatus status) { … }
void StrikeDatabase::OnDatabaseLoadKeysAndEntries(
bool success,
std::unique_ptr<std::map<std::string, StrikeData>> entries) { … }
void StrikeDatabase::GetProtoStrikes(const std::string& key,
const StrikesCallback& outer_callback) { … }
void StrikeDatabase::ClearAllProtoStrikes(
const ClearStrikesCallback& outer_callback) { … }
void StrikeDatabase::ClearAllProtoStrikesForKeys(
const std::vector<std::string>& keys,
const ClearStrikesCallback& outer_callback) { … }
void StrikeDatabase::ClearAllProtoStrikesForKey(
const std::string& key,
const ClearStrikesCallback& outer_callback) { … }
void StrikeDatabase::GetProtoStrikeData(const std::string& key,
const GetValueCallback& callback) { … }
void StrikeDatabase::SetProtoStrikeData(const std::string& key,
const StrikeData& data,
const SetValueCallback& callback) { … }
void StrikeDatabase::OnGetProtoStrikes(
StrikesCallback callback,
bool success,
std::unique_ptr<StrikeData> strike_data) { … }
void StrikeDatabase::LoadKeys(const LoadKeysCallback& callback) { … }
void StrikeDatabase::UpdateCache(const std::string& key,
const StrikeData& data) { … }
}