chrome: win: Fix taskbar grouping of PiP and DevTools windows (fixes #3641)

This commit is contained in:
Marshall Greenblatt 2024-02-06 13:55:01 -05:00
parent 7dbf26919a
commit 1bfee76f5f
5 changed files with 46 additions and 1 deletions

View File

@ -141,6 +141,10 @@ class BrowserDelegate : public content::WebContentsDelegate {
// Called at the end of a fullscreen transition. // Called at the end of a fullscreen transition.
virtual void WindowFullscreenStateChanged() {} 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 } // namespace cef

View File

@ -426,6 +426,12 @@ void ChromeBrowserDelegate::WindowFullscreenStateChanged() {
#endif #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( void ChromeBrowserDelegate::WebContentsCreated(
content::WebContents* source_contents, content::WebContents* source_contents,
int opener_render_process_id, int opener_render_process_id,

View File

@ -81,6 +81,7 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
const std::optional<SkRegion> GetDraggableRegion() const override; const std::optional<SkRegion> GetDraggableRegion() const override;
void UpdateDraggableRegion(const SkRegion& region) override; void UpdateDraggableRegion(const SkRegion& region) override;
void WindowFullscreenStateChanged() override; void WindowFullscreenStateChanged() override;
bool HasViewsHostedOpener() const override;
// WebContentsDelegate methods: // WebContentsDelegate methods:
void WebContentsCreated(content::WebContents* source_contents, void WebContentsCreated(content::WebContents* source_contents,

View File

@ -712,5 +712,10 @@ patches = [
# alloy: Don't create GPUCache directory when cache_path is empty. # alloy: Don't create GPUCache directory when cache_path is empty.
# https://github.com/chromiumembedded/cef/issues/3617 # https://github.com/chromiumembedded/cef/issues/3617
'name': 'content_renderer_host_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'
},
] ]

View File

@ -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 =