Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adapt to Chromium version 122 #33

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion include/CefViewBrowserClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,17 @@ class CefViewBrowserClient
const void* buffer,
int width,
int height) override;
#if CEF_VERSION_MAJOR >= 122
virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
const CefAcceleratedPaintInfo& info) override;
#else
virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
void* shared_handle) override;
#endif
virtual bool StartDragging(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> drag_data,
CefRenderHandler::DragOperationsMask allowed_ops,
Expand Down Expand Up @@ -378,8 +385,14 @@ class CefViewBrowserClient
int64 new_size,
CefRefPtr<CefCallback> callback) override;
#endif

#if CEF_VERSION_MAJOR >= 122
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
TerminationStatus status,
int error_code,
const CefString& error_string) override;
#else
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser, TerminationStatus status) override;
#endif
#pragma endregion

// CefResourceRequestHandler
Expand Down
47 changes: 47 additions & 0 deletions include/CefViewBrowserClientDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <string>

#include <include/cef_client.h>
#include <include/cef_version.h>

/// <summary>
///
Expand All @@ -27,6 +28,26 @@ class CefViewBrowserClientDelegateInterface

virtual void processUrlRequest(const std::string& url) = 0;

#if CEF_VERSION_MAJOR >= 122
virtual void processQueryRequest(CefRefPtr<CefBrowser>& browser,
const std::string& frameId,
const std::string& query,
const int64_t query_id) = 0;

virtual void focusedEditableNodeChanged(CefRefPtr<CefBrowser>& browser,
const std::string& frameId,
bool focusOnEditableNode) = 0;

virtual void invokeMethodNotify(CefRefPtr<CefBrowser>& browser,
const std::string& frameId,
const std::string& method,
const CefRefPtr<CefListValue>& arguments) = 0;

virtual void reportJSResult(CefRefPtr<CefBrowser>& browser,
const std::string& frameId,
const std::string& context,
const CefRefPtr<CefValue>& result) = 0;
#else
virtual void processQueryRequest(CefRefPtr<CefBrowser>& browser,
int64_t frameId,
const std::string& query,
Expand All @@ -45,6 +66,7 @@ class CefViewBrowserClientDelegateInterface
int64_t frameId,
const std::string& context,
const CefRefPtr<CefValue>& result) = 0;
#endif

// context menu handler
#pragma region ContextMenuHandler
Expand Down Expand Up @@ -80,7 +102,11 @@ class CefViewBrowserClientDelegateInterface

// display handler
#pragma region DisplayHandler
#if CEF_VERSION_MAJOR >= 122
virtual void addressChanged(CefRefPtr<CefBrowser>& browser, const std::string& frameId, const std::string& url) = 0;
#else
virtual void addressChanged(CefRefPtr<CefBrowser>& browser, int64_t frameId, const std::string& url) = 0;
#endif

virtual void titleChanged(CefRefPtr<CefBrowser>& browser, const std::string& title) = 0;

Expand Down Expand Up @@ -129,6 +155,16 @@ class CefViewBrowserClientDelegateInterface

// life span handler
#pragma region LifeSpanHandler
#if CEF_VERSION_MAJOR >= 122
virtual bool onBeforePopup(CefRefPtr<CefBrowser>& browser,
const std::string& frameId,
const std::string& targetUrl,
const std::string& targetFrameName,
CefLifeSpanHandler::WindowOpenDisposition targetDisposition,
CefWindowInfo& windowInfo,
CefBrowserSettings& settings,
bool& DisableJavascriptAccess) = 0;
#else
virtual bool onBeforePopup(CefRefPtr<CefBrowser>& browser,
int64_t frameId,
const std::string& targetUrl,
Expand All @@ -137,6 +173,8 @@ class CefViewBrowserClientDelegateInterface
CefWindowInfo& windowInfo,
CefBrowserSettings& settings,
bool& DisableJavascriptAccess) = 0;
#endif

virtual void onAfterCreate(CefRefPtr<CefBrowser>& browser) = 0;

virtual bool doClose(CefRefPtr<CefBrowser> browser) = 0;
Expand Down Expand Up @@ -209,12 +247,21 @@ class CefViewBrowserClientDelegateInterface
int height)
{
}
#if CEF_VERSION_MAJOR >= 122
virtual void onAcceleratedPaint(CefRefPtr<CefBrowser> browser,
CefRenderHandler::PaintElementType type,
const CefRenderHandler::RectList& dirtyRects,
const CefAcceleratedPaintInfo& info)
{
}
#else
virtual void onAcceleratedPaint(CefRefPtr<CefBrowser> browser,
CefRenderHandler::PaintElementType type,
const CefRenderHandler::RectList& dirtyRects,
void* shared_handle)
{
}
#endif
virtual bool startDragging(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> drag_data,
CefRenderHandler::DragOperationsMask allowed_ops,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,19 @@ CefViewBrowserClient::OnPaint(CefRefPtr<CefBrowser> browser,
if (delegate)
return delegate->onPaint(browser, type, dirtyRects, buffer, width, height);
}

#if CEF_VERSION_MAJOR >= 122
void
CefViewBrowserClient::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
const CefAcceleratedPaintInfo& shared_handle)
#else
void
CefViewBrowserClient::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
void* shared_handle)
#endif
{
auto delegate = client_delegate_.lock();
if (delegate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,16 @@ CefViewBrowserClient::OnQuotaRequest(CefRefPtr<CefBrowser> browser,
}
#endif

#if CEF_VERSION_MAJOR >= 122
void
CefViewBrowserClient::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
TerminationStatus status,
int error_code,
const CefString& error_string)
#else
void
CefViewBrowserClient::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser, TerminationStatus status)
#endif
{
CEF_REQUIRE_UI_THREAD();

Expand Down
Loading
Loading