cookie_settings_factory.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_COOKIE_SETTINGS_FACTORY_H_
  5. #define WEBLAYER_BROWSER_COOKIE_SETTINGS_FACTORY_H_
  6. #include "base/no_destructor.h"
  7. #include "components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h"
  8. namespace content_settings {
  9. class CookieSettings;
  10. }
  11. namespace weblayer {
  12. class CookieSettingsFactory
  13. : public RefcountedBrowserContextKeyedServiceFactory {
  14. public:
  15. CookieSettingsFactory(const CookieSettingsFactory&) = delete;
  16. CookieSettingsFactory& operator=(const CookieSettingsFactory&) = delete;
  17. static scoped_refptr<content_settings::CookieSettings> GetForBrowserContext(
  18. content::BrowserContext* browser_context);
  19. static CookieSettingsFactory* GetInstance();
  20. private:
  21. friend class base::NoDestructor<CookieSettingsFactory>;
  22. CookieSettingsFactory();
  23. ~CookieSettingsFactory() override;
  24. // BrowserContextKeyedServiceFactory methods:
  25. void RegisterProfilePrefs(
  26. user_prefs::PrefRegistrySyncable* registry) override;
  27. content::BrowserContext* GetBrowserContextToUse(
  28. content::BrowserContext* context) const override;
  29. scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor(
  30. content::BrowserContext* context) const override;
  31. };
  32. } // namespace weblayer
  33. #endif // WEBLAYER_BROWSER_COOKIE_SETTINGS_FACTORY_H_