Skip to content

Commit

Permalink
feat: adapt to Chromium version 122
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Super committed May 20, 2024
1 parent c79fb7f commit abaac3c
Show file tree
Hide file tree
Showing 7 changed files with 319 additions and 122 deletions.
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

0 comments on commit abaac3c

Please sign in to comment.