• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 
5 #ifndef CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_IMPL_H_
6 #define CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_IMPL_H_
7 #pragma once
8 
9 #include "include/cef_media_router.h"
10 #include "libcef/browser/browser_context.h"
11 
12 #include "components/media_router/common/media_route.h"
13 
14 // Implementation of the CefMediaRoute interface. Only created on the UI thread.
15 class CefMediaRouteImpl : public CefMediaRoute {
16  public:
17   CefMediaRouteImpl(const media_router::MediaRoute& route,
18                     const CefBrowserContext::Getter& browser_context_getter);
19 
20   CefMediaRouteImpl(const CefMediaRouteImpl&) = delete;
21   CefMediaRouteImpl& operator=(const CefMediaRouteImpl&) = delete;
22 
23   // CefMediaRoute methods.
24   CefString GetId() override;
25   CefRefPtr<CefMediaSource> GetSource() override;
26   CefRefPtr<CefMediaSink> GetSink() override;
27   void SendRouteMessage(const void* message, size_t message_size) override;
28   void Terminate() override;
29 
route()30   const media_router::MediaRoute& route() const { return route_; }
31 
32  private:
33   void SendRouteMessageInternal(std::string message);
34 
35   // Read-only after creation.
36   const media_router::MediaRoute route_;
37   const CefBrowserContext::Getter browser_context_getter_;
38 
39   IMPLEMENT_REFCOUNTING(CefMediaRouteImpl);
40 };
41 
42 #endif  // CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_IMPL_H_
43