heavy_ad_service_factory.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_HEAVY_AD_SERVICE_FACTORY_H_
  5. #define WEBLAYER_BROWSER_HEAVY_AD_SERVICE_FACTORY_H_
  6. #include "base/no_destructor.h"
  7. #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
  8. namespace content {
  9. class BrowserContext;
  10. }
  11. namespace heavy_ad_intervention {
  12. class HeavyAdService;
  13. }
  14. namespace weblayer {
  15. class HeavyAdServiceFactory : public BrowserContextKeyedServiceFactory {
  16. public:
  17. HeavyAdServiceFactory(const HeavyAdServiceFactory&) = delete;
  18. HeavyAdServiceFactory& operator=(const HeavyAdServiceFactory&) = delete;
  19. // Gets the HeavyAdService instance for |context|.
  20. static heavy_ad_intervention::HeavyAdService* GetForBrowserContext(
  21. content::BrowserContext* context);
  22. static HeavyAdServiceFactory* GetInstance();
  23. private:
  24. friend class base::NoDestructor<HeavyAdServiceFactory>;
  25. HeavyAdServiceFactory();
  26. ~HeavyAdServiceFactory() override;
  27. // BrowserContextKeyedServiceFactory:
  28. KeyedService* BuildServiceInstanceFor(
  29. content::BrowserContext* context) const override;
  30. content::BrowserContext* GetBrowserContextToUse(
  31. content::BrowserContext* context) const override;
  32. };
  33. } // namespace weblayer
  34. #endif // WEBLAYER_BROWSER_HEAVY_AD_SERVICE_FACTORY_H_