Launch the cefclient with the following flags: --use-views --enable-chrome-runtime
Observe the window being unminimized after start.
Without --enable-chrome-runtime flag, the window stays minimized.
Expected behavior
The application window should remain in a minimized state when using LoadURL to load a URL.
Versions (please complete the following information):
OS: Windows 10, MacOS 14.1..2
CEF Version: [119.4.7 and latest main]
Additional context
If params.user_gesture = false is added to CefFrameHostImpl::LoadURLWithExtras it fixes the issue:
if (frame_id == CefFrameHostImpl::kMainFrameId) {
// Load via the browser using NavigationController.
auto browser = GetBrowserHostBase();
if (browser) {
content::OpenURLParams params(
gurl, referrer, WindowOpenDisposition::CURRENT_TAB, transition,
/*is_renderer_initiated=*/false);
params.extra_headers = extra_headers;
+ params.user_gesture = false; // <-- adding this line fixes the issue
Description
The issue appears when attempting to redirect the user to a webpage using the following code snippet:
To Reproduce
Steps to reproduce the behavior:
tests/cefclient/cefclient_win.cc:106
, add a flag to open the window in a minimized state:tests/cefclient/browser/root_window_manager.cc:433
, after the browser is created, add a call to load any URL:--use-views --enable-chrome-runtime
Without
--enable-chrome-runtime
flag, the window stays minimized.Expected behavior
The application window should remain in a minimized state when using
LoadURL
to load a URL.Versions (please complete the following information):
Additional context
If
params.user_gesture = false
is added toCefFrameHostImpl::LoadURLWithExtras
it fixes the issue:https://github.com/chromiumembedded/cef/blob/2f0b00f8f59b1a9114fcd855fd7fef37c6ee24ea/libcef/browser/frame_host_impl.cc#L378
This
user_gesture
flag is then used inbool ChromeBrowserHostImpl::Navigate(const content::OpenURLParams& params)
to set properwindow_action
https://github.com/chromiumembedded/cef/blob/2f0b00f8f59b1a9114fcd855fd7fef37c6ee24ea/libcef/browser/chrome/chrome_browser_host_impl.cc#L447-L449And this window_action is used to determine whether to show window or not
https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/browser_navigator.cc;l=506;drc=bc07189b068b3088cd70f03e50b85064d8d04805