Skip to content

Commit

Permalink
feat: adpat CEF version 124
Browse files Browse the repository at this point in the history
  • Loading branch information
tishion committed Sep 14, 2024
1 parent 6a27a57 commit 3d61b79
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 28 deletions.
40 changes: 23 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,29 @@ configure_file(
message(STATUS "Detecting CEF_SDK_VERSION: ${CEF_SDK_VERSION}")

if(NOT CEF_SDK_VERSION)
# "89.0.12+g2b76680+chromium-89.0.4389.90" # GOOD
# "91.1.23+g04c8d56+chromium-91.0.4472.164" # GOOD
# "95.7.12+g99c4ac0+chromium-95.0.4638.54" # GOOD
# "99.2.15+g71e9523+chromium-99.0.4844.84" # GOOD
# "102.0.10+gf249b2e+chromium-102.0.5005.115" # GOOD
# "104.4.18+g2587cf2+chromium-104.0.5112.81" # BAD # crash on macOS - debug mode
# "104.4.26+g4180781+chromium-104.0.5112.102" # BAD # crash on macOS - debug mode
# "105.3.25+g0ca6a9e+chromium-105.0.5195.54" # BAD # debugbreak - debug mode
# "105.3.28+g002805e+chromium-105.0.5195.54" # BAD # debugbreak - debug mode
# "107.1.9+g1f0a21a+chromium-107.0.5304.110" # BAD # debugbreak - debug mode
# "110.0.26+g732747f+chromium-110.0.5481.97" # BAD # TO-BE-FIXED
# "113.3.1+g525fa10+chromium-113.0.5672.128" # GOOD
# "119.4.4+g5d1e039+chromium-119.0.6045.199" # GOOD
# "120.1.6+gf08b1fd+chromium-120.0.6099.71" # GOOD
# "121.3.15+g4d3b0b4+chromium-121.0.6167.184" # GOOD
# "122.1.7+gdd187af+chromium-122.0.6261.29"
set(DEFAULT_CEF_SDK_VER "119.4.4+g5d1e039+chromium-119.0.6045.199")
# set(DEFAULT_CEF_SDK_VER "89.0.12+g2b76680+chromium-89.0.4389.90") # GOOD
# set(DEFAULT_CEF_SDK_VER "91.1.23+g04c8d56+chromium-91.0.4472.164") # GOOD
# set(DEFAULT_CEF_SDK_VER "95.7.12+g99c4ac0+chromium-95.0.4638.54") # GOOD
# set(DEFAULT_CEF_SDK_VER "99.2.15+g71e9523+chromium-99.0.4844.84") # GOOD
# set(DEFAULT_CEF_SDK_VER "102.0.10+gf249b2e+chromium-102.0.5005.115") # GOOD
# set(DEFAULT_CEF_SDK_VER "104.4.18+g2587cf2+chromium-104.0.5112.81") # BAD # crash on macOS - debug mode
# set(DEFAULT_CEF_SDK_VER "104.4.26+g4180781+chromium-104.0.5112.102") # BAD # crash on macOS - debug mode
# set(DEFAULT_CEF_SDK_VER "105.3.25+g0ca6a9e+chromium-105.0.5195.54") # BAD # debugbreak - debug mode
# set(DEFAULT_CEF_SDK_VER "105.3.28+g002805e+chromium-105.0.5195.54") # BAD # debugbreak - debug mode
# set(DEFAULT_CEF_SDK_VER "107.1.9+g1f0a21a+chromium-107.0.5304.110") # BAD # debugbreak - debug mode
# set(DEFAULT_CEF_SDK_VER "110.0.26+g732747f+chromium-110.0.5481.97") # BAD # TO-BE-FIXED
# set(DEFAULT_CEF_SDK_VER "113.3.1+g525fa10+chromium-113.0.5672.128") # GOOD
# set(DEFAULT_CEF_SDK_VER "119.4.4+g5d1e039+chromium-119.0.6045.199") # GOOD
# set(DEFAULT_CEF_SDK_VER "120.1.6+gf08b1fd+chromium-120.0.6099.71") # GOOD
# set(DEFAULT_CEF_SDK_VER "121.3.15+g4d3b0b4+chromium-121.0.6167.184") # GOOD
# set(DEFAULT_CEF_SDK_VER "122.1.13+gde5b724+chromium-122.0.6261.130") # NOT-TEST
# set(DEFAULT_CEF_SDK_VER "123.0.13+gfc703fb+chromium-123.0.6312.124") # NOT-TEST
# set(DEFAULT_CEF_SDK_VER "124.3.9+g9bd638f+chromium-124.0.6367.207") # NOT-TEST
# set(DEFAULT_CEF_SDK_VER "125.0.22+gc410c95+chromium-125.0.6422.142") # NOT-TEST
# set(DEFAULT_CEF_SDK_VER "126.2.18+g3647d39+chromium-126.0.6478.183") # NOT-TEST
set(DEFAULT_CEF_SDK_VER "127.3.5+g114ea2a+chromium-127.0.6533.120") # GOOD

# set(DEFAULT_CEF_SDK_VER "128.4.9+g9840ad9+chromium-128.0.6613.120") # BAD # debugbreak - debug mode
message(STATUS
"CEF_SDK_VERSION is empty, use default version ${DEFAULT_CEF_SDK_VER}\n"
"You can change the version by adding -DCEF_SDK_VERSION=xxx to commandline for generation")
Expand Down
46 changes: 43 additions & 3 deletions include/CefViewBrowserClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,33 @@ class CefViewBrowserClient
// CefDialogHandler
#pragma region CefDialogHandler
virtual CefRefPtr<CefDialogHandler> GetDialogHandler() override;

#if CEF_VERSION_MAJOR < 102
virtual bool OnFileDialog(CefRefPtr<CefBrowser> browser,
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
#if CEF_VERSION_MAJOR < 102
int selected_accept_filter,
#endif
CefRefPtr<CefFileDialogCallback> callback) override;
#elif CEF_VERSION_MAJOR < 126
virtual bool OnFileDialog(CefRefPtr<CefBrowser> browser,
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
CefRefPtr<CefFileDialogCallback> callback) override;
#else
virtual bool OnFileDialog(CefRefPtr<CefBrowser> browser,
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
const std::vector<CefString>& accept_extensions,
const std::vector<CefString>& accept_descriptions,
CefRefPtr<CefFileDialogCallback> callback) override;
#endif

#pragma endregion

// CefDisplayHandler methods
Expand Down Expand Up @@ -231,10 +249,17 @@ class CefViewBrowserClient
// CefDownloadHandler
#pragma region CefDownloadHandler
virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler() override;
void OnBeforeDownload(CefRefPtr<CefBrowser> browser,
#if CEF_VERSION_MAJOR < 125
virtual void OnBeforeDownload(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback) override;
#else
virtual bool OnBeforeDownload(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback) override;
#endif

void OnDownloadUpdated(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
Expand Down Expand Up @@ -343,10 +368,17 @@ class CefViewBrowserClient
const void* buffer,
int width,
int height) override;
#if CEF_VERSION_MAJOR < 124
virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
void* shared_handle) override;
#else
virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
const CefAcceleratedPaintInfo& info) override;
#endif
virtual bool StartDragging(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> drag_data,
CefRenderHandler::DragOperationsMask allowed_ops,
Expand Down Expand Up @@ -384,7 +416,15 @@ class CefViewBrowserClient
CefRefPtr<CefCallback> callback) override;
#endif

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

#pragma endregion

// CefResourceRequestHandler
Expand Down
9 changes: 9 additions & 0 deletions include/CefViewBrowserClientDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,21 @@ class CefViewBrowserClientDelegateInterface
int height)
{
}
#if CEF_VERSION_MAJOR < 124
virtual void onAcceleratedPaint(CefRefPtr<CefBrowser> browser,
CefRenderHandler::PaintElementType type,
const CefRenderHandler::RectList& dirtyRects,
void* shared_handle)
{
}
#else
virtual void onAcceleratedPaint(CefRefPtr<CefBrowser> browser,
CefRenderHandler::PaintElementType type,
const CefRenderHandler::RectList& dirtyRects,
const CefAcceleratedPaintInfo& info)
{
}
#endif
virtual bool startDragging(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> drag_data,
CefRenderHandler::DragOperationsMask allowed_ops,
Expand Down
1 change: 0 additions & 1 deletion include/CefViewCoreGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Project: include
* Created: 30 May 2023
* Author: Sheen Tian
* This file was generated by CMake, do not modify this manually
*/
#ifndef CefViewCoreGlobal_h
#define CefViewCoreGlobal_h
Expand Down
32 changes: 25 additions & 7 deletions src/CefView/CefBrowserApp/CefViewBrowserClient_DialogHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,34 @@ CefViewBrowserClient::GetDialogHandler()
return this;
}

#if CEF_VERSION_MAJOR < 102
bool
CefViewBrowserClient::OnFileDialog(CefRefPtr<CefBrowser> browser,
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
#if CEF_VERSION_MAJOR < 102
int selected_accept_filter,
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
int selected_accept_filter,
CefRefPtr<CefFileDialogCallback> callback)
#elif CEF_VERSION_MAJOR < 126
bool
CefViewBrowserClient::OnFileDialog(CefRefPtr<CefBrowser> browser,
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
CefRefPtr<CefFileDialogCallback> callback)
#else
bool
CefViewBrowserClient::OnFileDialog(CefRefPtr<CefBrowser> browser,
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
const std::vector<CefString>& accept_extensions,
const std::vector<CefString>& accept_descriptions,
CefRefPtr<CefFileDialogCallback> callback)
#endif
CefRefPtr<CefFileDialogCallback> callback)
{
auto delegate = client_delegate_.lock();
if (delegate)
Expand Down
17 changes: 17 additions & 0 deletions src/CefView/CefBrowserApp/CefViewBrowserClient_DownloadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CefViewBrowserClient::GetDownloadHandler()
return this;
}

#if CEF_VERSION_MAJOR < 125
void
CefViewBrowserClient::OnBeforeDownload(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
Expand All @@ -26,6 +27,22 @@ CefViewBrowserClient::OnBeforeDownload(CefRefPtr<CefBrowser> browser,
if (delegate)
delegate->onBeforeDownload(browser, download_item, suggested_name, callback);
}
#else
bool
CefViewBrowserClient::OnBeforeDownload(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback)
{
CEF_REQUIRE_UI_THREAD();

auto delegate = client_delegate_.lock();
if (delegate)
delegate->onBeforeDownload(browser, download_item, suggested_name, callback);

return false;
}
#endif

void
CefViewBrowserClient::OnDownloadUpdated(CefRefPtr<CefBrowser> browser,
Expand Down
14 changes: 14 additions & 0 deletions src/CefView/CefBrowserApp/CefViewBrowserClient_RenderHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ CefViewBrowserClient::OnPaint(CefRefPtr<CefBrowser> browser,
return delegate->onPaint(browser, type, dirtyRects, buffer, width, height);
}

#if CEF_VERSION_MAJOR < 124
void
CefViewBrowserClient::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
Expand All @@ -100,6 +101,19 @@ CefViewBrowserClient::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
if (delegate)
delegate->onAcceleratedPaint(browser, type, dirtyRects, shared_handle);
}
#else

void
CefViewBrowserClient::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
const CefAcceleratedPaintInfo& info)
{
auto delegate = client_delegate_.lock();
if (delegate)
delegate->onAcceleratedPaint(browser, type, dirtyRects, info);
}
#endif

bool
CefViewBrowserClient::StartDragging(CefRefPtr<CefBrowser> browser,
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 < 124
void
CefViewBrowserClient::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser, TerminationStatus status)
#else
void
CefViewBrowserClient::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
TerminationStatus status,
int error_code,
const CefString& error_string)
#endif
{
CEF_REQUIRE_UI_THREAD();

Expand Down

0 comments on commit 3d61b79

Please sign in to comment.