• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 The Chromium Embedded Framework 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 
5 #ifndef CEF_LIBCEF_BROWSER_OSR_HOST_DISPLAY_CLIENT_OSR_H_
6 #define CEF_LIBCEF_BROWSER_OSR_HOST_DISPLAY_CLIENT_OSR_H_
7 
8 #include <memory>
9 
10 #include "base/callback.h"
11 #include "base/memory/shared_memory_mapping.h"
12 #include "components/viz/host/host_display_client.h"
13 #include "ui/gfx/native_widget_types.h"
14 
15 class CefLayeredWindowUpdaterOSR;
16 class CefRenderWidgetHostViewOSR;
17 
18 class CefHostDisplayClientOSR : public viz::HostDisplayClient {
19  public:
20   CefHostDisplayClientOSR(CefRenderWidgetHostViewOSR* const view,
21                           gfx::AcceleratedWidget widget);
22 
23   CefHostDisplayClientOSR(const CefHostDisplayClientOSR&) = delete;
24   CefHostDisplayClientOSR& operator=(const CefHostDisplayClientOSR&) = delete;
25 
26   ~CefHostDisplayClientOSR() override;
27 
28   void SetActive(bool active);
29   const void* GetPixelMemory() const;
30   gfx::Size GetPixelSize() const;
31 
32  private:
33   // mojom::DisplayClient implementation.
34   void UseProxyOutputDevice(UseProxyOutputDeviceCallback callback) override;
35 
36   void CreateLayeredWindowUpdater(
37       mojo::PendingReceiver<viz::mojom::LayeredWindowUpdater> receiver)
38       override;
39 
40 #if BUILDFLAG(IS_LINUX)
41   void DidCompleteSwapWithNewSize(const gfx::Size& size) override;
42 #endif
43 
44   CefRenderWidgetHostViewOSR* const view_;
45   std::unique_ptr<CefLayeredWindowUpdaterOSR> layered_window_updater_;
46   bool active_ = false;
47 };
48 
49 #endif  // CEF_LIBCEF_BROWSER_OSR_HOST_DISPLAY_CLIENT_OSR_H_
50