host_content_settings_map_factory.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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_HOST_CONTENT_SETTINGS_MAP_FACTORY_H_
  5. #define WEBLAYER_BROWSER_HOST_CONTENT_SETTINGS_MAP_FACTORY_H_
  6. #include "base/memory/ref_counted.h"
  7. #include "base/memory/singleton.h"
  8. #include "components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h"
  9. class HostContentSettingsMap;
  10. namespace weblayer {
  11. class HostContentSettingsMapFactory
  12. : public RefcountedBrowserContextKeyedServiceFactory {
  13. public:
  14. HostContentSettingsMapFactory(const HostContentSettingsMapFactory&) = delete;
  15. HostContentSettingsMapFactory& operator=(
  16. const HostContentSettingsMapFactory&) = delete;
  17. static HostContentSettingsMap* GetForBrowserContext(
  18. content::BrowserContext* browser_context);
  19. static HostContentSettingsMapFactory* GetInstance();
  20. private:
  21. friend struct base::DefaultSingletonTraits<HostContentSettingsMapFactory>;
  22. HostContentSettingsMapFactory();
  23. ~HostContentSettingsMapFactory() override;
  24. // RefcountedBrowserContextKeyedServiceFactory methods:
  25. scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor(
  26. content::BrowserContext* context) const override;
  27. content::BrowserContext* GetBrowserContextToUse(
  28. content::BrowserContext* context) const override;
  29. };
  30. } // namespace weblayer
  31. #endif // WEBLAYER_BROWSER_HOST_CONTENT_SETTINGS_MAP_FACTORY_H_