• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 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_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_
6 #define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_
7 
8 #include "libcef/browser/native/browser_platform_delegate_native_aura.h"
9 
10 #include "ui/ozone/buildflags.h"
11 
12 #if BUILDFLAG(OZONE_PLATFORM_X11)
13 class CefWindowX11;
14 #endif
15 
16 // Windowed browser implementation for Linux.
17 class CefBrowserPlatformDelegateNativeLinux
18     : public CefBrowserPlatformDelegateNativeAura {
19  public:
20   CefBrowserPlatformDelegateNativeLinux(const CefWindowInfo& window_info,
21                                         SkColor background_color);
22 
23   // CefBrowserPlatformDelegate methods:
24   void BrowserDestroyed(CefBrowserHostBase* browser) override;
25   bool CreateHostWindow() override;
26   void CloseHostWindow() override;
27   CefWindowHandle GetHostWindowHandle() const override;
28   views::Widget* GetWindowWidget() const override;
29   void SetFocus(bool setFocus) override;
30   void NotifyMoveOrResizeStarted() override;
31   void SizeTo(int width, int height) override;
32   gfx::Point GetScreenPoint(const gfx::Point& view) const override;
33   void ViewText(const std::string& text) override;
34   bool HandleKeyboardEvent(
35       const content::NativeWebKeyboardEvent& event) override;
36   CefEventHandle GetEventHandle(
37       const content::NativeWebKeyboardEvent& event) const override;
38   std::unique_ptr<CefMenuRunner> CreateMenuRunner() override;
39   gfx::Point GetDialogPosition(const gfx::Size& size) override;
40   gfx::Size GetMaximumDialogSize() override;
41 
42   // CefBrowserPlatformDelegateNativeAura methods:
43   ui::KeyEvent TranslateUiKeyEvent(const CefKeyEvent& key_event) const override;
44   content::NativeWebKeyboardEvent TranslateWebKeyEvent(
45       const CefKeyEvent& key_event) const override;
46 
47  private:
48   // True if the host window has been created.
49   bool host_window_created_;
50 
51   // Widget hosting the web contents. It will be deleted automatically when the
52   // associated root window is destroyed.
53   views::Widget* window_widget_;
54 
55 #if BUILDFLAG(OZONE_PLATFORM_X11)
56   CefWindowX11* window_x11_ = nullptr;
57 #endif
58 };
59 
60 #endif  // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_
61