chromiumembedded/cef

cefclient: Show "save as" prompt for downloads when controls are hidden

Closed this issue · 4 comments

Describe the bug
When running cefclient with no controls (e.g. by passing the --hide-controls flag or setting RootWindowConfig::with_controls to false), downloading files seems impossible: the usual "save as" prompt doesn't show and no download is performed.

To Reproduce
Steps to reproduce the behavior:

  1. Run cefclient with the --hide-controls flag
  2. Replace the google homepage with some HTML to download a file, e.g :
    <a href="https://cef-builds.spotifycdn.com/cef_binary_126.2.12%2Bg162c3d6%2Bchromium-126.0.6478.127_windows64.tar.bz2" download>Download</a>
  3. Click the link: nothing happens

Expected behavior
A prompt like the following is expected: https://rehost.diberie.com/Picture/Get/f/300841
Instead, nothing happens (no prompt, no download)

Versions (please complete the following information):

  • OS: Windows 10
  • CEF Version: 126.2.0

Additional context
With cefsimple --hide-controls, the file is downloaded without any "save as" prompt.

Desired behavior is likely showing the "Save As" prompt in all cases.

The cefclient app is intentionally blocking the download here when controls are hidden:

[4497:259:0717/145522.928686:INFO:client_handler.cc(827)] Blocking download

The toolbar also appears briefly while the client window is being created/displayed, which is not desired.

This also reproduces on MacOS.

The client should implement CefDownloadHandler::OnBeforeDownload to show the "Save As" dialog (same as here in cefclient).

The toolbar also appears briefly while the client window is being created/displayed, which is not desired.

Filed as #3745.