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