chromiumembedded / cef

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

Chrome bootstrap + Chrome style unable to disable certain Chrome popup/bubble options #3754

Closed BrianAndersonMozenda closed 1 month ago

BrianAndersonMozenda commented 1 month ago

Describe the bug Using Chrome bootstrap + Chrome style there are a lot of popups/bubbles that pull focus from the browser and create annoyances in the UI. Here are a few that we have been unable to work around with command line parameters:

To Reproduce Download multiple files Steps to reproduce the behavior:

  1. Change the cefclient OnBeforeDownload Continue callback parameter "showDialog" from true to false and provide a local path for the file to be downloaded to.
  2. Run cefclient with the chrome style (default).
  3. Navigate to a site with a download file (something like https://www.thinkbroadband.com/download)
  4. Select 512 MB button, 200 MB button, and 10 MB button to download the test content
  5. Assert files are allowed to download without user intervention

To Reproduce Download completed Steps to reproduce the behavior:

  1. Change the cefclient OnBeforeDownload Continue callback parameter "showDialog" from true to false and provide a local path for the file to be downloaded to.
  2. Run cefclient with the chrome style (default).
  3. Navigate to a site with a download file (something like https://www.thinkbroadband.com/download)
  4. Select 10 MB (small) button to download the test content
  5. Assert after the download is completed that a popup bubble doesn't appear

To Reproduce Know your location Steps to reproduce the behavior:

  1. Run cefclient with the chrome style (default).
  2. Navigate to a site that wants to pull your location (ie www.kay.com, www.homedepot.com)
  3. Assert after the know your location popup bubble doesn't appear

To Reproduce Link hover in bottom left corner Steps to reproduce the behavior:

  1. Run cefclient with the chrome style (default).
  2. Navigate to a site with a download file (something like https://www.thinkbroadband.com/download)
  3. Mouse over a link or download link
  4. Assert no link hover tip appears in the lower left hand corner

Expected behavior Expecting to have the ability from command line parameters to be able to block these types of popups/bubbles.

Screenshots If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

Additional context Does the problem reproduce with the cefclient or cefsimple sample application at the same version? Yes - The reproduce in the cefclient test app.

Does the problem reproduce with Google Chrome at the same version? We have found that some of these can be turned off in settings.

Add any other context about the problem here. These popups create a lot of annoyance and confusion because they pull focus from the browser and don't allow injected JavaScript cannot initiate the subsequent processes until the user manually handles these dialogs so that the browser can regain focus.

magreenblatt commented 1 month ago

We have found that some of these can be turned off in settings.

Which ones cannot be turned off in settings?

BrianAndersonMozenda commented 1 month ago

I am unable to find chrome://settings for the following:

I am able to find the settings for the following, however, I am unable to set them with settings in CEF

salvadordf commented 1 month ago

Several of these settings can be handled in CefPermissionHandler.OnShowPermissionPrompt

For the download bubble set the following preferences to false :

BrianAndersonMozenda commented 1 month ago

@salvadordf

Thank you.

Here are the some of the ways that we have found to accomplish the above tasks - However, especially for the download bubble, this doesn't fix the pulling focus from the browser issue.

Download completed

CfxValue downloadsValue = CfxValue.Create();
downloadsValue.SetBool(false);
bool success = CfxRequestContext.GetGlobalContext().SetPreference("download_bubble.partial_view_enabled", downloadsValue, out string error);

Download multiple files

CfxValue downloadMultiple = CfxValue.Create();
downloadMultiple.SetInt(1);
success = CfxRequestContext.GetGlobalContext().SetPreference("profile.default_content_setting_values.automatic_downloads", downloadMultiple, out error);

Know your location

CfxValue locationServicesValue = CfxValue.Create();
locationServicesValue.SetBool(false);
success = CfxRequestContext.GetGlobalContext().SetPreference("profile.content_settings.enable_quiet_permission_ui.geolocation", locationServicesValue, out error);