#include "components/commerce/core/discounts_storage.h"
#include "base/check.h"
#include "base/functional/callback.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "components/commerce/core/commerce_constants.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/commerce_types.h"
#include "components/commerce/core/commerce_utils.h"
#include "components/commerce/core/proto/discounts_db_content.pb.h"
#include "components/session_proto_db/session_proto_storage.h"
namespace commerce {
const char kDiscountsFetchResultHistogramName[] = …;
DiscountsStorage::DiscountsStorage(
SessionProtoStorage<DiscountsContent>* discounts_proto_db,
history::HistoryService* history_service)
: … { … }
DiscountsStorage::~DiscountsStorage() = default;
void DiscountsStorage::HandleServerDiscounts(
const GURL& url,
std::vector<DiscountInfo> server_results,
DiscountInfoCallback callback) { … }
void DiscountsStorage::SaveDiscounts(const GURL& url,
const std::vector<DiscountInfo>& infos) { … }
void DiscountsStorage::DeleteDiscountsForUrl(const std::string& url) { … }
void DiscountsStorage::OnLoadDiscounts(const GURL& url,
DiscountInfoCallback callback,
bool succeeded,
DiscountsKeyAndValues data) { … }
std::vector<DiscountInfo> DiscountsStorage::GetUnexpiredDiscountsFromProto(
const DiscountsContent& proto) { … }
void DiscountsStorage::OnHistoryDeletions(
history::HistoryService* history_service,
const history::DeletionInfo& deletion_info) { … }
}