2020-09-25 03:40:47 +02:00
|
|
|
// Copyright 2020 The Chromium Embedded Framework Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
|
|
|
|
|
|
|
|
#include "libcef/browser/browser_platform_delegate.h"
|
|
|
|
#include "libcef/browser/native/browser_platform_delegate_native.h"
|
|
|
|
|
|
|
|
class Browser;
|
|
|
|
|
|
|
|
// Implementation of Chrome-based browser functionality.
|
|
|
|
class CefBrowserPlatformDelegateChrome
|
|
|
|
: public CefBrowserPlatformDelegate,
|
|
|
|
public CefBrowserPlatformDelegateNative::WindowlessHandler {
|
|
|
|
public:
|
|
|
|
explicit CefBrowserPlatformDelegateChrome(
|
|
|
|
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate);
|
|
|
|
|
|
|
|
// CefBrowserPlatformDelegate overrides.
|
|
|
|
void WebContentsCreated(content::WebContents* web_contents,
|
|
|
|
bool owned) override;
|
|
|
|
void WebContentsDestroyed(content::WebContents* web_contents) override;
|
|
|
|
void BrowserCreated(CefBrowserHostBase* browser) override;
|
|
|
|
void BrowserDestroyed(CefBrowserHostBase* browser) override;
|
2022-04-19 19:45:03 +02:00
|
|
|
CefWindowHandle GetHostWindowHandle() const override;
|
2020-09-25 03:40:47 +02:00
|
|
|
SkColor GetBackgroundColor() const override;
|
|
|
|
void SendKeyEvent(const CefKeyEvent& event) override;
|
|
|
|
void SendMouseClickEvent(const CefMouseEvent& event,
|
|
|
|
CefBrowserHost::MouseButtonType type,
|
|
|
|
bool mouseUp,
|
|
|
|
int clickCount) override;
|
|
|
|
void SendMouseMoveEvent(const CefMouseEvent& event, bool mouseLeave) override;
|
|
|
|
void SendMouseWheelEvent(const CefMouseEvent& event,
|
|
|
|
int deltaX,
|
|
|
|
int deltaY) override;
|
2022-05-13 13:38:41 +02:00
|
|
|
gfx::Point GetScreenPoint(const gfx::Point& view,
|
|
|
|
bool want_dip_coords) const override;
|
2020-09-25 03:40:47 +02:00
|
|
|
void ViewText(const std::string& text) override;
|
2021-02-18 02:58:25 +01:00
|
|
|
CefEventHandle GetEventHandle(
|
|
|
|
const content::NativeWebKeyboardEvent& event) const override;
|
2020-09-25 03:40:47 +02:00
|
|
|
|
|
|
|
// CefBrowserPlatformDelegateNative::WindowlessHandler methods:
|
|
|
|
CefWindowHandle GetParentWindowHandle() const override;
|
2022-05-13 13:38:41 +02:00
|
|
|
gfx::Point GetParentScreenPoint(const gfx::Point& view,
|
|
|
|
bool want_dip_coords) const override;
|
2020-09-25 03:40:47 +02:00
|
|
|
|
|
|
|
void set_chrome_browser(Browser* browser);
|
|
|
|
|
2022-04-08 22:48:56 +02:00
|
|
|
CefBrowserPlatformDelegateNative* native_delegate() const {
|
|
|
|
return native_delegate_.get();
|
|
|
|
}
|
|
|
|
|
2021-02-18 02:58:25 +01:00
|
|
|
protected:
|
2022-04-19 19:45:03 +02:00
|
|
|
gfx::NativeWindow GetNativeWindow() const;
|
|
|
|
|
2020-09-25 03:40:47 +02:00
|
|
|
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate_;
|
|
|
|
|
|
|
|
Browser* chrome_browser_ = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
|