• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 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_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
6 #define CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
7 
8 #include "libcef/browser/browser_platform_delegate.h"
9 #include "libcef/browser/native/browser_platform_delegate_native.h"
10 
11 class Browser;
12 
13 // Implementation of Chrome-based browser functionality.
14 class CefBrowserPlatformDelegateChrome
15     : public CefBrowserPlatformDelegate,
16       public CefBrowserPlatformDelegateNative::WindowlessHandler {
17  public:
18   explicit CefBrowserPlatformDelegateChrome(
19       std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate);
20 
21   // CefBrowserPlatformDelegate overrides.
22   void WebContentsCreated(content::WebContents* web_contents,
23                           bool owned) override;
24   void WebContentsDestroyed(content::WebContents* web_contents) override;
25   void BrowserCreated(CefBrowserHostBase* browser) override;
26   void BrowserDestroyed(CefBrowserHostBase* browser) override;
27   SkColor GetBackgroundColor() const override;
28   void SendKeyEvent(const CefKeyEvent& event) override;
29   void SendMouseClickEvent(const CefMouseEvent& event,
30                            CefBrowserHost::MouseButtonType type,
31                            bool mouseUp,
32                            int clickCount) override;
33   void SendMouseMoveEvent(const CefMouseEvent& event, bool mouseLeave) override;
34   void SendMouseWheelEvent(const CefMouseEvent& event,
35                            int deltaX,
36                            int deltaY) override;
37   gfx::Point GetScreenPoint(const gfx::Point& view) const override;
38   void ViewText(const std::string& text) override;
39   CefEventHandle GetEventHandle(
40       const content::NativeWebKeyboardEvent& event) const override;
41 
42   // CefBrowserPlatformDelegateNative::WindowlessHandler methods:
43   CefWindowHandle GetParentWindowHandle() const override;
44   gfx::Point GetParentScreenPoint(const gfx::Point& view) const override;
45 
46   void set_chrome_browser(Browser* browser);
47 
48  protected:
49   std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate_;
50 
51   Browser* chrome_browser_ = nullptr;
52 };
53 
54 #endif  // CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
55