chromium/chrome/browser/persisted_state_db/session_proto_db_factory.h

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_PERSISTED_STATE_DB_SESSION_PROTO_DB_FACTORY_H_
#define CHROME_BROWSER_PERSISTED_STATE_DB_SESSION_PROTO_DB_FACTORY_H_

#include "base/no_destructor.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile_keyed_service_factory.h"
#include "components/commerce/core/proto/commerce_subscription_db_content.pb.h"
#include "components/commerce/core/proto/parcel_tracking_db_content.pb.h"
#include "components/session_proto_db/session_proto_db.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"

#if !BUILDFLAG(IS_ANDROID)
#include "components/commerce/core/proto/cart_db_content.pb.h"
#include "components/commerce/core/proto/coupon_db_content.pb.h"
#include "components/commerce/core/proto/discounts_db_content.pb.h"  // nogncheck
#else
#include "components/commerce/core/proto/merchant_signal_db_content.pb.h"
#endif

namespace {
const char kPersistedStateDBFolder[] =;
const char kChromeCartDBFolder[] =;
const char kMerchantTrustSignalDBFolder[] =;
const char kCommerceSubscriptionDBFolder[] =;
const char kCouponDBFolder[] =;
const char kDiscountsDBFolder[] =;
const char kParcelTrackingDBFolder[] =;
}  // namespace

SessionProtoDBFactory<persisted_state_db::PersistedStateContentProto>*
GetPersistedStateSessionProtoDBFactory();

#if !BUILDFLAG(IS_ANDROID)
SessionProtoDBFactory<cart_db::ChromeCartContentProto>*
GetChromeCartSessionProtoDBFactory();
SessionProtoDBFactory<coupon_db::CouponContentProto>*
GetCouponSessionProtoDBFactory();
SessionProtoDBFactory<discounts_db::DiscountsContentProto>*
GetDiscountsSessionProtoDBFactory();
#else
SessionProtoDBFactory<merchant_signal_db::MerchantSignalContentProto>*
GetMerchantSignalSessionProtoDBFactory();
#endif

SessionProtoDBFactory<
    commerce_subscription_db::CommerceSubscriptionContentProto>*
GetCommerceSubscriptionSessionProtoDBFactory();

SessionProtoDBFactory<parcel_tracking_db::ParcelTrackingContent>*
GetParcelTrackingSessionProtoDBFactory();

// Factory to create a ProtoDB per browsing session (BrowserContext) and per
// proto. Incognito is currently not supported and the factory will return
// nullptr for an incognito profile.
template <typename T>
class SessionProtoDBFactory : public ProfileKeyedServiceFactory {};

// static
template <typename T>
SessionProtoDB<T>* SessionProtoDBFactory<T>::GetForProfile(
    content::BrowserContext* context) {}

template <typename T>
SessionProtoDBFactory<T>::SessionProtoDBFactory()
    :{}

template <typename T>
SessionProtoDBFactory<T>::~SessionProtoDBFactory() = default;

template <typename T>
KeyedService* SessionProtoDBFactory<T>::BuildServiceInstanceFor(
    content::BrowserContext* context) const {}

#endif  // CHROME_BROWSER_PERSISTED_STATE_DB_SESSION_PROTO_DB_FACTORY_H_