accept_languages_service_factory.h 1.5 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_ACCEPT_LANGUAGES_SERVICE_FACTORY_H_
  5. #define WEBLAYER_BROWSER_ACCEPT_LANGUAGES_SERVICE_FACTORY_H_
  6. #include "base/no_destructor.h"
  7. #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
  8. namespace language {
  9. class AcceptLanguagesService;
  10. }
  11. namespace weblayer {
  12. // AcceptLanguagesServiceFactory is a way to associate an
  13. // AcceptLanguagesService instance to a BrowserContext.
  14. class AcceptLanguagesServiceFactory : public BrowserContextKeyedServiceFactory {
  15. public:
  16. AcceptLanguagesServiceFactory(const AcceptLanguagesServiceFactory&) = delete;
  17. AcceptLanguagesServiceFactory& operator=(
  18. const AcceptLanguagesServiceFactory&) = delete;
  19. static language::AcceptLanguagesService* GetForBrowserContext(
  20. content::BrowserContext* browser_context);
  21. static AcceptLanguagesServiceFactory* GetInstance();
  22. private:
  23. friend class base::NoDestructor<AcceptLanguagesServiceFactory>;
  24. AcceptLanguagesServiceFactory();
  25. ~AcceptLanguagesServiceFactory() override;
  26. // BrowserContextKeyedServiceFactory:
  27. KeyedService* BuildServiceInstanceFor(
  28. content::BrowserContext* profile) const override;
  29. content::BrowserContext* GetBrowserContextToUse(
  30. content::BrowserContext* context) const override;
  31. };
  32. } // namespace weblayer
  33. #endif // WEBLAYER_BROWSER_ACCEPT_LANGUAGES_SERVICE_FACTORY_H_