subresource_filter_profile_context_factory.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2020 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_SUBRESOURCE_FILTER_PROFILE_CONTEXT_FACTORY_H_
  5. #define WEBLAYER_BROWSER_SUBRESOURCE_FILTER_PROFILE_CONTEXT_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 subresource_filter {
  12. class SubresourceFilterProfileContext;
  13. }
  14. namespace weblayer {
  15. // This class is responsible for instantiating a profile-scoped context for
  16. // subresource filtering.
  17. class SubresourceFilterProfileContextFactory
  18. : public BrowserContextKeyedServiceFactory {
  19. public:
  20. static SubresourceFilterProfileContextFactory* GetInstance();
  21. static subresource_filter::SubresourceFilterProfileContext*
  22. GetForBrowserContext(content::BrowserContext* browser_context);
  23. SubresourceFilterProfileContextFactory(
  24. const SubresourceFilterProfileContextFactory&) = delete;
  25. SubresourceFilterProfileContextFactory& operator=(
  26. const SubresourceFilterProfileContextFactory&) = delete;
  27. private:
  28. friend class base::NoDestructor<SubresourceFilterProfileContextFactory>;
  29. SubresourceFilterProfileContextFactory();
  30. // BrowserContextKeyedServiceFactory:
  31. KeyedService* BuildServiceInstanceFor(
  32. content::BrowserContext* context) const override;
  33. content::BrowserContext* GetBrowserContextToUse(
  34. content::BrowserContext* context) const override;
  35. };
  36. } // namespace weblayer
  37. #endif // WEBLAYER_BROWSER_SUBRESOURCE_FILTER_PROFILE_CONTEXT_FACTORY_H_