#include "components/feature_engagement/internal/event_model_impl.h"
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "components/feature_engagement/internal/event_model.h"
#include "components/feature_engagement/internal/event_storage_validator.h"
#include "components/feature_engagement/internal/event_store.h"
namespace feature_engagement {
EventModelImpl::EventModelImpl(
std::unique_ptr<EventStore> store,
std::unique_ptr<EventStorageValidator> storage_validator)
: … { … }
EventModelImpl::~EventModelImpl() = default;
void EventModelImpl::Initialize(OnModelInitializationFinished callback,
uint32_t current_day) { … }
bool EventModelImpl::IsReady() const { … }
const Event* EventModelImpl::GetEvent(const std::string& event_name) const { … }
uint32_t EventModelImpl::GetEventCount(const std::string& event_name,
uint32_t current_day,
uint32_t window_size) const { … }
void EventModelImpl::IncrementEvent(const std::string& event_name,
uint32_t current_day) { … }
void EventModelImpl::ClearEvent(const std::string& event_name) { … }
void EventModelImpl::IncrementSnooze(const std::string& event_name,
uint32_t current_day,
base::Time current_time) { … }
void EventModelImpl::DismissSnooze(const std::string& event_name) { … }
base::Time EventModelImpl::GetLastSnoozeTimestamp(
const std::string& event_name) const { … }
uint32_t EventModelImpl::GetSnoozeCount(const std::string& event_name,
uint32_t window,
uint32_t current_day) const { … }
bool EventModelImpl::IsSnoozeDismissed(const std::string& event_name) const { … }
void EventModelImpl::OnStoreLoaded(OnModelInitializationFinished callback,
uint32_t current_day,
bool success,
std::unique_ptr<std::vector<Event>> events) { … }
int EventModelImpl::GetEventCountOrSnooze(const std::string& event_name,
int current_day,
int window,
bool is_snooze) const { … }
Event& EventModelImpl::GetNonConstEvent(const std::string& event_name) { … }
}