Skip to content

Commit

Permalink
feat: unify the paramters type
Browse files Browse the repository at this point in the history
  • Loading branch information
tishion committed Jan 19, 2025
1 parent 53b9e2b commit 23cc785
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 106 deletions.
112 changes: 58 additions & 54 deletions src/details/CCefClientDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,37 +73,37 @@ class CCefClientDelegate

// ContextMenuHandler
#pragma region ContextMenuHandler
virtual void onBeforeContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model) override;

virtual bool onRunContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model,
CefRefPtr<CefRunContextMenuCallback> callback) override;

virtual bool onContextMenuCommand(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
virtual void onBeforeContextMenu(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefFrame>& frame,
CefRefPtr<CefContextMenuParams>& params,
CefRefPtr<CefMenuModel>& model) override;

virtual bool onRunContextMenu(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefFrame>& frame,
CefRefPtr<CefContextMenuParams>& params,
CefRefPtr<CefMenuModel>& model,
CefRefPtr<CefRunContextMenuCallback>& callback) override;

virtual bool onContextMenuCommand(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefFrame>& frame,
CefRefPtr<CefContextMenuParams>& params,
int command_id,
CefContextMenuHandler::EventFlags event_flags) override;

virtual void onContextMenuDismissed(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame) override;
virtual void onContextMenuDismissed(CefRefPtr<CefBrowser>& browser, CefRefPtr<CefFrame>& frame) override;
#pragma endregion

// DialogHandler
#pragma region DialogHandler
virtual bool onFileDialog(CefRefPtr<CefBrowser> browser,
virtual bool onFileDialog(CefRefPtr<CefBrowser>& browser,
CefBrowserHost::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;
CefRefPtr<CefFileDialogCallback>& callback) override;
#pragma endregion

// DisplayHandler
Expand All @@ -112,34 +112,34 @@ class CCefClientDelegate
CefRefPtr<CefFrame>& frame,
const CefString& url) override;
virtual void titleChanged(CefRefPtr<CefBrowser>& browser, const CefString& title) override;
virtual void faviconURLChanged(CefRefPtr<CefBrowser> browser, const std::vector<CefString>& icon_urls) override;
virtual void faviconURLChanged(CefRefPtr<CefBrowser>& browser, const std::vector<CefString>& icon_urls) override;
virtual void fullscreenModeChanged(CefRefPtr<CefBrowser>& browser, bool fullscreen) override;
virtual bool tooltipMessage(CefRefPtr<CefBrowser>& browser, const CefString& text) override;
virtual void statusMessage(CefRefPtr<CefBrowser>& browser, const CefString& value) override;
virtual void consoleMessage(CefRefPtr<CefBrowser>& browser, const CefString& message, int level) override;
virtual void loadingProgressChanged(CefRefPtr<CefBrowser>& browser, double progress) override;
virtual bool cursorChanged(CefRefPtr<CefBrowser> browser,
virtual bool cursorChanged(CefRefPtr<CefBrowser>& browser,
CefCursorHandle cursor,
cef_cursor_type_t type,
const CefCursorInfo& custom_cursor_info) override;
#pragma endregion

// DownloadHander
#pragma region DownloadHander
virtual void onBeforeDownload(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
virtual void onBeforeDownload(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefDownloadItem>& download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback) override;
CefRefPtr<CefBeforeDownloadCallback>& callback) override;

virtual void onDownloadUpdated(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
CefRefPtr<CefDownloadItemCallback> callback) override;
virtual void onDownloadUpdated(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefDownloadItem>& download_item,
CefRefPtr<CefDownloadItemCallback>& callback) override;
#pragma endregion

// DragHandler
#pragma region DragHandler
virtual bool onDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
virtual bool onDragEnter(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefDragData>& dragData,
CefDragHandler::DragOperationsMask mask) override;
virtual void draggableRegionChanged(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefFrame>& frame,
Expand All @@ -155,28 +155,28 @@ class CCefClientDelegate

// JSDialogHandler
#pragma region JSDialogHandler
virtual bool onJSDialog(CefRefPtr<CefBrowser> browser,
virtual bool onJSDialog(CefRefPtr<CefBrowser>& browser,
const CefString& origin_url,
CefJSDialogHandler::JSDialogType dialog_type,
const CefString& message_text,
const CefString& default_prompt_text,
CefRefPtr<CefJSDialogCallback> callback,
CefRefPtr<CefJSDialogCallback>& callback,
bool& suppress_message) override;
virtual bool onBeforeUnloadDialog(CefRefPtr<CefBrowser> browser,
virtual bool onBeforeUnloadDialog(CefRefPtr<CefBrowser>& browser,
const CefString& message_text,
bool is_reload,
CefRefPtr<CefJSDialogCallback> callback) override;
virtual void onResetDialogState(CefRefPtr<CefBrowser> browser) override;
virtual void onDialogClosed(CefRefPtr<CefBrowser> browser) override;
CefRefPtr<CefJSDialogCallback>& callback) override;
virtual void onResetDialogState(CefRefPtr<CefBrowser>& browser) override;
virtual void onDialogClosed(CefRefPtr<CefBrowser>& browser) override;
#pragma endregion

// KeyboardHandler
#pragma region KeyboardHandler
virtual bool onPreKeyEvent(CefRefPtr<CefBrowser> browser,
virtual bool onPreKeyEvent(CefRefPtr<CefBrowser>& browser,
const CefKeyEvent& event,
CefEventHandle os_event,
bool* is_keyboard_shortcut) override;
virtual bool onKeyEvent(CefRefPtr<CefBrowser> browser, const CefKeyEvent& event, CefEventHandle os_event) override;
virtual bool onKeyEvent(CefRefPtr<CefBrowser>& browser, const CefKeyEvent& event, CefEventHandle os_event) override;
#pragma endregion

// LifeSpanHandler
Expand All @@ -190,9 +190,9 @@ class CCefClientDelegate
CefBrowserSettings& settings,
bool& disableJavascriptAccess) override;
virtual void onAfterCreate(CefRefPtr<CefBrowser>& browser) override;
virtual bool doClose(CefRefPtr<CefBrowser> browser) override;
virtual bool requestClose(CefRefPtr<CefBrowser> browser) override;
virtual void onBeforeClose(CefRefPtr<CefBrowser> browser) override;
virtual bool doClose(CefRefPtr<CefBrowser>& browser) override;
virtual bool requestClose(CefRefPtr<CefBrowser>& browser) override;
virtual void onBeforeClose(CefRefPtr<CefBrowser>& browser) override;
#pragma endregion

// LoadHandler
Expand All @@ -213,43 +213,47 @@ class CCefClientDelegate

// RenderHandler
#pragma region RenderHandler
virtual bool getRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override;
virtual void getViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override;
virtual bool getScreenPoint(CefRefPtr<CefBrowser> browser, int viewX, int viewY, int& screenX, int& screenY) override;
virtual bool getScreenInfo(CefRefPtr<CefBrowser> browser, CefScreenInfo& screen_info) override;
virtual void onPopupShow(CefRefPtr<CefBrowser> browser, bool show) override;
virtual void onPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect) override;
virtual void onPaint(CefRefPtr<CefBrowser> browser,
virtual bool getRootScreenRect(CefRefPtr<CefBrowser>& browser, CefRect& rect) override;
virtual void getViewRect(CefRefPtr<CefBrowser>& browser, CefRect& rect) override;
virtual bool getScreenPoint(CefRefPtr<CefBrowser>& browser,
int viewX,
int viewY,
int& screenX,
int& screenY) override;
virtual bool getScreenInfo(CefRefPtr<CefBrowser>& browser, CefScreenInfo& screen_info) override;
virtual void onPopupShow(CefRefPtr<CefBrowser>& browser, bool show) override;
virtual void onPopupSize(CefRefPtr<CefBrowser>& browser, const CefRect& rect) override;
virtual void onPaint(CefRefPtr<CefBrowser>& browser,
CefRenderHandler::PaintElementType type,
const CefRenderHandler::RectList& dirtyRects,
const void* buffer,
int width,
int height) override;
#if CEF_VERSION_MAJOR < 124
virtual void onAcceleratedPaint(CefRefPtr<CefBrowser> browser,
virtual void onAcceleratedPaint(CefRefPtr<CefBrowser>& browser,
CefRenderHandler::PaintElementType type,
const CefRenderHandler::RectList& dirtyRects,
void* shared_handle) override;
#else
virtual void onAcceleratedPaint(CefRefPtr<CefBrowser> browser,
virtual void onAcceleratedPaint(CefRefPtr<CefBrowser>& browser,
CefRenderHandler::PaintElementType type,
const CefRenderHandler::RectList& dirtyRects,
const CefAcceleratedPaintInfo& info) override;
#endif
virtual bool startDragging(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> drag_data,
virtual bool startDragging(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefDragData>& drag_data,
CefRenderHandler::DragOperationsMask allowed_ops,
int x,
int y) override;
virtual void updateDragCursor(CefRefPtr<CefBrowser> browser, CefRenderHandler::DragOperation operation) override;
virtual void onScrollOffsetChanged(CefRefPtr<CefBrowser> browser, double x, double y) override;
virtual void onImeCompositionRangeChanged(CefRefPtr<CefBrowser> browser,
virtual void updateDragCursor(CefRefPtr<CefBrowser>& browser, CefRenderHandler::DragOperation operation) override;
virtual void onScrollOffsetChanged(CefRefPtr<CefBrowser>& browser, double x, double y) override;
virtual void onImeCompositionRangeChanged(CefRefPtr<CefBrowser>& browser,
const CefRange& selected_range,
const CefRenderHandler::RectList& character_bounds) override;
virtual void onTextSelectionChanged(CefRefPtr<CefBrowser> browser,
virtual void onTextSelectionChanged(CefRefPtr<CefBrowser>& browser,
const CefString& selected_text,
const CefRange& selected_range) override;
virtual void onVirtualKeyboardRequested(CefRefPtr<CefBrowser> browser,
virtual void onVirtualKeyboardRequested(CefRefPtr<CefBrowser>& browser,
CefRenderHandler::TextInputMode input_mode) override;
#pragma endregion
};
26 changes: 13 additions & 13 deletions src/details/handler/CCefClientDelegate_ContextMenuHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include "details/QCefViewPrivate.h"

void
CCefClientDelegate::onBeforeContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model)
CCefClientDelegate::onBeforeContextMenu(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefFrame>& frame,
CefRefPtr<CefContextMenuParams>& params,
CefRefPtr<CefMenuModel>& model)
{
FLog();

Expand Down Expand Up @@ -40,11 +40,11 @@ CCefClientDelegate::onBeforeContextMenu(CefRefPtr<CefBrowser> browser,
}

bool
CCefClientDelegate::onRunContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model,
CefRefPtr<CefRunContextMenuCallback> callback)
CCefClientDelegate::onRunContextMenu(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefFrame>& frame,
CefRefPtr<CefContextMenuParams>& params,
CefRefPtr<CefMenuModel>& model,
CefRefPtr<CefRunContextMenuCallback>& callback)
{
FLog();

Expand All @@ -65,9 +65,9 @@ CCefClientDelegate::onRunContextMenu(CefRefPtr<CefBrowser> browser,
}

bool
CCefClientDelegate::onContextMenuCommand(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CCefClientDelegate::onContextMenuCommand(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefFrame>& frame,
CefRefPtr<CefContextMenuParams>& params,
int command_id,
CefContextMenuHandler::EventFlags event_flags)
{
Expand All @@ -77,7 +77,7 @@ CCefClientDelegate::onContextMenuCommand(CefRefPtr<CefBrowser> browser,
}

void
CCefClientDelegate::onContextMenuDismissed(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame)
CCefClientDelegate::onContextMenuDismissed(CefRefPtr<CefBrowser>& browser, CefRefPtr<CefFrame>& frame)
{
FLog();

Expand Down
4 changes: 2 additions & 2 deletions src/details/handler/CCefClientDelegate_DialogHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
#include "details/utils/ValueConvertor.h"

bool
CCefClientDelegate::onFileDialog(CefRefPtr<CefBrowser> browser,
CCefClientDelegate::onFileDialog(CefRefPtr<CefBrowser>& browser,
CefBrowserHost::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)
CefRefPtr<CefFileDialogCallback>& callback)
{
QMetaObject::invokeMethod(pCefViewPrivate_, [=]() {
QStringList filters;
Expand Down
4 changes: 2 additions & 2 deletions src/details/handler/CCefClientDelegate_DisplayHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ CCefClientDelegate::titleChanged(CefRefPtr<CefBrowser>& browser, const CefString
}

void
CCefClientDelegate::faviconURLChanged(CefRefPtr<CefBrowser> browser, const std::vector<CefString>& icon_urls)
CCefClientDelegate::faviconURLChanged(CefRefPtr<CefBrowser>& browser, const std::vector<CefString>& icon_urls)
{
if (!IsValidBrowser(browser))
return;
Expand Down Expand Up @@ -145,7 +145,7 @@ CCefClientDelegate::loadingProgressChanged(CefRefPtr<CefBrowser>& browser, doubl
}

bool
CCefClientDelegate::cursorChanged(CefRefPtr<CefBrowser> browser,
CCefClientDelegate::cursorChanged(CefRefPtr<CefBrowser>& browser,
CefCursorHandle cursor,
cef_cursor_type_t type,
const CefCursorInfo& custom_cursor_info)
Expand Down
12 changes: 6 additions & 6 deletions src/details/handler/CCefClientDelegate_DownloadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#include "details/utils/ValueConvertor.h"

void
CCefClientDelegate::onBeforeDownload(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
CCefClientDelegate::onBeforeDownload(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefDownloadItem>& download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback)
CefRefPtr<CefBeforeDownloadCallback>& callback)
{
FLog();

Expand Down Expand Up @@ -80,9 +80,9 @@ CCefClientDelegate::onBeforeDownload(CefRefPtr<CefBrowser> browser,
}

void
CCefClientDelegate::onDownloadUpdated(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
CefRefPtr<CefDownloadItemCallback> callback)
CCefClientDelegate::onDownloadUpdated(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefDownloadItem>& download_item,
CefRefPtr<CefDownloadItemCallback>& callback)
{
FLog();

Expand Down
4 changes: 2 additions & 2 deletions src/details/handler/CCefClientDelegate_DragHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "details/QCefViewPrivate.h"

bool
CCefClientDelegate::onDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
CCefClientDelegate::onDragEnter(CefRefPtr<CefBrowser>& browser,
CefRefPtr<CefDragData>& dragData,
CefDragHandler::DragOperationsMask mask)
{
// Return false for default drag handling behavior or true to cancel the drag event.
Expand Down
Loading

0 comments on commit 23cc785

Please sign in to comment.