web_data_service_wrapper_factory.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_FACTORY_H_
  5. #define COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_FACTORY_H_
  6. #include "base/memory/scoped_refptr.h"
  7. #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
  8. #include "components/keyed_service/core/service_access_type.h"
  9. namespace content {
  10. class BrowserContext;
  11. } // namespace content
  12. namespace payments {
  13. class PaymentManifestWebDataService;
  14. } // namespace payments
  15. class WebDataServiceWrapper;
  16. namespace webdata_services {
  17. // A factory that lazily returns a WebDataServiceWrapper implementation for a
  18. // given BrowserContext.
  19. class WebDataServiceWrapperFactory : public BrowserContextKeyedServiceFactory {
  20. public:
  21. WebDataServiceWrapperFactory(const WebDataServiceWrapperFactory&) = delete;
  22. WebDataServiceWrapperFactory& operator=(const WebDataServiceWrapperFactory&) =
  23. delete;
  24. static WebDataServiceWrapper* GetForBrowserContext(
  25. content::BrowserContext* context,
  26. ServiceAccessType access_type);
  27. static WebDataServiceWrapper* GetForBrowserContextIfExists(
  28. content::BrowserContext* context,
  29. ServiceAccessType access_type);
  30. static scoped_refptr<payments::PaymentManifestWebDataService>
  31. GetPaymentManifestWebDataServiceForBrowserContext(
  32. content::BrowserContext* context,
  33. ServiceAccessType access_type);
  34. static WebDataServiceWrapperFactory* GetInstance();
  35. protected:
  36. WebDataServiceWrapperFactory();
  37. ~WebDataServiceWrapperFactory() override;
  38. };
  39. } // namespace webdata_services
  40. #endif // COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_WRAPPER_FACTORY_H_