• 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   // CefMediaRoute methods.
21   CefString GetId() override;
22   CefRefPtr<CefMediaSource> GetSource() override;
23   CefRefPtr<CefMediaSink> GetSink() override;
24   void SendRouteMessage(const void* message, size_t message_size) override;
25   void Terminate() override;
26 
route()27   const media_router::MediaRoute& route() const { return route_; }
28 
29  private:
30   void SendRouteMessageInternal(std::string message);
31 
32   // Read-only after creation.
33   const media_router::MediaRoute route_;
34   const CefBrowserContext::Getter browser_context_getter_;
35 
36   IMPLEMENT_REFCOUNTING(CefMediaRouteImpl);
37   DISALLOW_COPY_AND_ASSIGN(CefMediaRouteImpl);
38 };
39 
40 #endif  // CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_IMPL_H_
41