web_data_service_factory.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 WEBLAYER_BROWSER_WEB_DATA_SERVICE_FACTORY_H_
  5. #define WEBLAYER_BROWSER_WEB_DATA_SERVICE_FACTORY_H_
  6. #include "base/no_destructor.h"
  7. #include "components/webdata_services/web_data_service_wrapper_factory.h"
  8. namespace weblayer {
  9. // Singleton that owns all WebDataServiceWrappers and associates them with
  10. // Profiles.
  11. class WebDataServiceFactory
  12. : public webdata_services::WebDataServiceWrapperFactory {
  13. public:
  14. WebDataServiceFactory(const WebDataServiceFactory&) = delete;
  15. WebDataServiceFactory& operator=(const WebDataServiceFactory&) = delete;
  16. static WebDataServiceFactory* GetInstance();
  17. private:
  18. friend class base::NoDestructor<WebDataServiceFactory>;
  19. WebDataServiceFactory();
  20. ~WebDataServiceFactory() override;
  21. // |BrowserContextKeyedServiceFactory| methods:
  22. content::BrowserContext* GetBrowserContextToUse(
  23. content::BrowserContext* context) const override;
  24. KeyedService* BuildServiceInstanceFor(
  25. content::BrowserContext* profile) const override;
  26. bool ServiceIsNULLWhileTesting() const override;
  27. };
  28. } // namespace weblayer
  29. #endif // WEBLAYER_BROWSER_WEB_DATA_SERVICE_FACTORY_H_