cef icon indicating copy to clipboard operation
cef copied to clipboard

chrome: Add CefDragHandler::OnDragEnter support

Open vyunikov opened this issue 9 months ago • 2 comments

On Windows, in CEF version 136 and 137 CefDragHandler::OnDragEnter is never being called when a file is dragged to an HTML page, which handles Drag-and-Drop.

To Reproduce Steps to reproduce the behavior:

  1. Add these lines to simple_handler.h in cefsimple:
CefRefPtr<CefDragHandler> GetDragHandler() override { return this; }
virtual bool OnDragEnter(CefRefPtr<CefBrowser> browser,
    CefRefPtr<CefDragData> dragData,
    DragOperationsMask mask) 
  {
    ::MessageBox(NULL, L"!!!!!!", L"!!!!!!", 0);
    return true;
  }
  1. I will attach html test pages, which can be used to verify this behavior.

Expected behavior When a files is being dragged onto an area which handles DnD, OnDragEnter should be called

Versions (please complete the following information):

  • OS: Windows 11
  • CEF Version: 136., 137.

Additional context Does the problem reproduce with the cefclient or cefsimple sample application at the same version?

Yes, easily reproducible. I will attach html test pages As an additional context, I build with sandbox disabled.

vyunikov avatar Jul 21 '25 20:07 vyunikov

html.zip

vyunikov avatar Jul 21 '25 20:07 vyunikov

Chrome style does not currently intercept Browser::CanDragEnter to override default drag event handling.

Testing with M138 and dragging an HTML file from Windows Explorer into the browser content area:

  • ClientHandler::OnDragEnter is called for Alloy style (cefclient --use-alloy-style)
  • ClientHandler::OnOpenURLFromTab is called for Chrome style, with target_disposition=CEF_WOD_NEW_FOREGROUND_TAB and user_gesture=true

magreenblatt avatar Jul 22 '25 17:07 magreenblatt