#include "chrome/browser/commerce/coupons/coupon_service.h"
#include "base/observer_list.h"
#include "base/ranges/algorithm.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/proto/coupon_db_content.pb.h"
namespace {
void ConstructCouponProto(
const GURL& origin,
const std::vector<std::unique_ptr<autofill::AutofillOfferData>>& offers,
const CouponService::CouponDisplayTimeMap& coupon_time_map,
coupon_db::CouponContentProto* proto) { … }
bool CompareCouponList(
const std::vector<std::unique_ptr<autofill::AutofillOfferData>>&
coupon_list_a,
const std::vector<std::unique_ptr<autofill::AutofillOfferData>>&
coupon_list_b) { … }
}
CouponService::CouponService(std::unique_ptr<CouponDB> coupon_db)
: … { … }
CouponService::~CouponService() = default;
void CouponService::UpdateFreeListingCoupons(const CouponsMap& coupon_map) { … }
void CouponService::DeleteFreeListingCouponsForUrl(const GURL& url) { … }
void CouponService::DeleteAllFreeListingCoupons() { … }
base::Time CouponService::GetCouponDisplayTimestamp(
const autofill::AutofillOfferData& offer) { … }
void CouponService::RecordCouponDisplayTimestamp(
const autofill::AutofillOfferData& offer) { … }
void CouponService::MaybeFeatureStatusChanged(bool enabled) { … }
CouponService::Coupons CouponService::GetFreeListingCouponsForUrl(
const GURL& url) { … }
bool CouponService::IsUrlEligible(const GURL& url) { … }
void CouponService::AddObserver(CouponServiceObserver* observer) { … }
void CouponService::RemoveObserver(CouponServiceObserver* observer) { … }
CouponService::CouponService() = default;
void CouponService::InitializeCouponsMap() { … }
void CouponService::OnInitializeCouponsMap(
bool success,
std::vector<CouponDB::KeyAndValue> proto_pairs) { … }
void CouponService::OnUpdateCouponTimestamp(
int64_t coupon_id,
const base::Time last_display_timestamp,
bool success,
std::vector<CouponDB::KeyAndValue> proto_pairs) { … }
CouponDB* CouponService::GetDB() { … }
void CouponService::NotifyObserversOfInvalidatedCoupon(const GURL& url) { … }