media_router_factory.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_MEDIA_MEDIA_ROUTER_FACTORY_H_
  5. #define WEBLAYER_BROWSER_MEDIA_MEDIA_ROUTER_FACTORY_H_
  6. #include "base/no_destructor.h"
  7. #include "components/media_router/browser/media_router_factory.h"
  8. namespace content {
  9. class BrowserContext;
  10. }
  11. namespace weblayer {
  12. class MediaRouterFactory : public media_router::MediaRouterFactory {
  13. public:
  14. MediaRouterFactory(const MediaRouterFactory&) = delete;
  15. MediaRouterFactory& operator=(const MediaRouterFactory&) = delete;
  16. static MediaRouterFactory* GetInstance();
  17. // Determines if media router related features should be enabled.
  18. static bool IsFeatureEnabled();
  19. // Performs platform and WebLayer-specific initialization for media_router.
  20. static void DoPlatformInitIfNeeded();
  21. private:
  22. friend base::NoDestructor<MediaRouterFactory>;
  23. MediaRouterFactory();
  24. ~MediaRouterFactory() override;
  25. // MediaRouterFactory:
  26. content::BrowserContext* GetBrowserContextToUse(
  27. content::BrowserContext* context) const override;
  28. KeyedService* BuildServiceInstanceFor(
  29. content::BrowserContext* context) const override;
  30. };
  31. } // namespace weblayer
  32. #endif // WEBLAYER_BROWSER_MEDIA_MEDIA_ROUTER_FACTORY_H_