Skip to content

Commit

Permalink
fix: the compatible problem for earlier cef version
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheen Tian committed Jun 20, 2024
1 parent c79fb7f commit 861d9fe
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
3 changes: 3 additions & 0 deletions include/CefViewBrowserClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ class CefViewBrowserClient
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;
#pragma endregion

Expand Down
15 changes: 6 additions & 9 deletions include/CefViewBrowserClientDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,16 @@ class CefViewBrowserClientDelegateInterface
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)
{
return false;
};
#pragma endregion

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

Expand Down Expand Up @@ -186,19 +189,13 @@ class CefViewBrowserClientDelegateInterface

// Off screen rendering
#pragma region RenderHandler
virtual bool getRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect)
{
return false;
}
virtual bool getRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) { return false; }
virtual void getViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) {}
virtual bool getScreenPoint(CefRefPtr<CefBrowser> browser, int viewX, int viewY, int& screenX, int& screenY)
{
return false;
}
virtual bool getScreenInfo(CefRefPtr<CefBrowser> browser, CefScreenInfo& screen_info)
{
return false;
}
virtual bool getScreenInfo(CefRefPtr<CefBrowser> browser, CefScreenInfo& screen_info) { return false; }
virtual void onPopupShow(CefRefPtr<CefBrowser> browser, bool show) {}
virtual void onPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect) {}
virtual void onPaint(CefRefPtr<CefBrowser> browser,
Expand Down
13 changes: 12 additions & 1 deletion src/CefView/CefBrowserApp/CefViewBrowserClient_DialogHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,22 @@ CefViewBrowserClient::OnFileDialog(CefRefPtr<CefBrowser> browser,
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)
{
auto delegate = client_delegate_.lock();
if (delegate)
return delegate->onFileDialog(browser, mode, title, default_file_path, accept_filters, callback);
return delegate->onFileDialog(browser,
mode,
title,
default_file_path,
accept_filters,
#if CEF_VERSION_MAJOR < 102
selected_accept_filter,
#endif,
callback);

return false;
}

0 comments on commit 861d9fe

Please sign in to comment.