chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.38k stars 467 forks source link

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

Closed MichelFionfray closed 4 months ago

MichelFionfray commented 4 months ago

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):

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

magreenblatt commented 4 months ago

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

magreenblatt commented 4 months ago

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.

magreenblatt commented 4 months ago

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

magreenblatt commented 4 months ago

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

Filed as #3745.