diff --git a/libcef/browser/chrome/browser_delegate.h b/libcef/browser/chrome/browser_delegate.h index 8202a0206..6ef90b5aa 100644 --- a/libcef/browser/chrome/browser_delegate.h +++ b/libcef/browser/chrome/browser_delegate.h @@ -141,6 +141,10 @@ class BrowserDelegate : public content::WebContentsDelegate { // Called at the end of a fullscreen transition. virtual void WindowFullscreenStateChanged() {} + + // Returns true if this browser has a Views-hosted opener. Only + // applicable for Browsers of type picture_in_picture and devtools. + virtual bool HasViewsHostedOpener() const { return false; } }; } // namespace cef diff --git a/libcef/browser/chrome/chrome_browser_delegate.cc b/libcef/browser/chrome/chrome_browser_delegate.cc index 2049d655f..9a3455da8 100644 --- a/libcef/browser/chrome/chrome_browser_delegate.cc +++ b/libcef/browser/chrome/chrome_browser_delegate.cc @@ -426,6 +426,12 @@ void ChromeBrowserDelegate::WindowFullscreenStateChanged() { #endif } +bool ChromeBrowserDelegate::HasViewsHostedOpener() const { + DCHECK(browser_->is_type_picture_in_picture() || + browser_->is_type_devtools()); + return opener_host_ && opener_host_->is_views_hosted(); +} + void ChromeBrowserDelegate::WebContentsCreated( content::WebContents* source_contents, int opener_render_process_id, diff --git a/libcef/browser/chrome/chrome_browser_delegate.h b/libcef/browser/chrome/chrome_browser_delegate.h index 6b721ec5b..04153e7fd 100644 --- a/libcef/browser/chrome/chrome_browser_delegate.h +++ b/libcef/browser/chrome/chrome_browser_delegate.h @@ -81,6 +81,7 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate { const std::optional GetDraggableRegion() const override; void UpdateDraggableRegion(const SkRegion& region) override; void WindowFullscreenStateChanged() override; + bool HasViewsHostedOpener() const override; // WebContentsDelegate methods: void WebContentsCreated(content::WebContents* source_contents, diff --git a/patch/patch.cfg b/patch/patch.cfg index 0b92dae96..39f642cb8 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -712,5 +712,10 @@ patches = [ # alloy: Don't create GPUCache directory when cache_path is empty. # https://github.com/chromiumembedded/cef/issues/3617 'name': 'content_renderer_host_3617' - } + }, + { + # chrome: win: Fix taskbar grouping of PiP and DevTools windows. + # https://github.com/chromiumembedded/cef/issues/3641 + 'name': 'win_taskbar_group_3641' + }, ] diff --git a/patch/patches/win_taskbar_group_3641.patch b/patch/patches/win_taskbar_group_3641.patch new file mode 100644 index 000000000..1aa110b9a --- /dev/null +++ b/patch/patches/win_taskbar_group_3641.patch @@ -0,0 +1,29 @@ +diff --git chrome/browser/ui/views/frame/browser_window_property_manager_win.cc chrome/browser/ui/views/frame/browser_window_property_manager_win.cc +index 1a62480aee22c..9da572856c03b 100644 +--- chrome/browser/ui/views/frame/browser_window_property_manager_win.cc ++++ chrome/browser/ui/views/frame/browser_window_property_manager_win.cc +@@ -8,6 +8,7 @@ + #include "base/functional/bind.h" + #include "base/strings/utf_string_conversions.h" + #include "base/win/windows_version.h" ++#include "cef/libcef/features/features.h" + #include "chrome/browser/browser_process.h" + #include "chrome/browser/profiles/profile.h" + #include "chrome/browser/profiles/profile_manager.h" +@@ -49,6 +50,16 @@ void BrowserWindowPropertyManager::UpdateWindowProperties() { + const Browser* browser = view_->browser(); + Profile* profile = browser->profile(); + ++#if BUILDFLAG(ENABLE_CEF) ++ if (browser->cef_delegate() && ++ (browser->is_type_picture_in_picture() || ++ browser->is_type_devtools()) && ++ browser->cef_delegate()->HasViewsHostedOpener()) { ++ // Don't create a separate taskbar group. ++ return; ++ } ++#endif ++ + // Set the app user model id for this application to that of the application + // name. See http://crbug.com/7028. + std::wstring app_id =