Commit 92403630 authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

Set appid on Pip windows.

Calls SetAppIdForWindow() in OverlayWindowViews::Create, using the
appid of the web contents window that opened the Pip Window. This makes
the Pip window get grouped with the window the Pip window was opened
from on the Windows taskbar.

Bug: 1116776
Change-Id: I23bb2cb8770c1778817a09139cb778f2b2e5549e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2388274
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarBecca Hughes <beccahughes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805336}
parent 0616362e
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h" #include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h"
#include "chrome/browser/ui/views/overlay/close_image_button.h" #include "chrome/browser/ui/views/overlay/close_image_button.h"
#include "chrome/browser/ui/views/overlay/playback_image_button.h" #include "chrome/browser/ui/views/overlay/playback_image_button.h"
...@@ -44,6 +47,13 @@ ...@@ -44,6 +47,13 @@
#include "ui/aura/window.h" #include "ui/aura/window.h"
#endif #endif
#if defined(OS_WIN)
#include "chrome/browser/shell_integration_win.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/win/shell.h"
#endif
namespace { namespace {
constexpr gfx::Size kMinWindowSize(260, 146); constexpr gfx::Size kMinWindowSize(260, 146);
...@@ -208,6 +218,27 @@ std::unique_ptr<content::OverlayWindow> OverlayWindowViews::Create( ...@@ -208,6 +218,27 @@ std::unique_ptr<content::OverlayWindow> OverlayWindowViews::Create(
overlay_window->Init(std::move(params)); overlay_window->Init(std::move(params));
overlay_window->OnRootViewReady(); overlay_window->OnRootViewReady();
#if defined(OS_WIN)
base::string16 app_user_model_id;
Browser* browser =
chrome::FindBrowserWithWebContents(controller->GetWebContents());
if (browser) {
const base::FilePath& profile_path = browser->profile()->GetPath();
// Set the window app id to GetAppUserModelIdForApp if the original window
// is an app window, GetAppUserModelIdForBrowser if it's a browser window.
app_user_model_id =
browser->is_type_app()
? shell_integration::win::GetAppUserModelIdForApp(
base::UTF8ToWide(browser->app_name()), profile_path)
: shell_integration::win::GetAppUserModelIdForBrowser(profile_path);
if (!app_user_model_id.empty()) {
ui::win::SetAppIdForWindow(
app_user_model_id,
overlay_window->GetNativeWindow()->GetHost()->GetAcceleratedWidget());
}
}
#endif // defined(OS_WIN)
return overlay_window; return overlay_window;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment