mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Bug 1592234 - Add window icon to PiP window r=kpatenio,mhowell
Differential Revision: https://phabricator.services.mozilla.com/D134429
This commit is contained in:
parent
83e6733608
commit
f9defb0250
@ -16,6 +16,13 @@ const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
XPCOMUtils.defineLazyServiceGetters(this, {
|
||||
WindowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],
|
||||
});
|
||||
|
||||
const PLAYER_URI = "chrome://global/content/pictureinpicture/player.xhtml";
|
||||
var PLAYER_FEATURES =
|
||||
"chrome,titlebar=yes,alwaysontop,lockaspectratio,resizable";
|
||||
@ -410,6 +417,10 @@ var PictureInPicture = {
|
||||
null
|
||||
);
|
||||
|
||||
if (Services.appinfo.OS == "WINNT") {
|
||||
WindowsUIUtils.setWindowIconNoData(pipWindow);
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
pipWindow.addEventListener(
|
||||
"load",
|
||||
|
@ -17,6 +17,8 @@ interface nsIWindowsUIUtils : nsISupports
|
||||
|
||||
void setWindowIcon(in mozIDOMWindowProxy aWindow, in imgIContainer aSmallIcon, in imgIContainer aLargeIcon);
|
||||
|
||||
void setWindowIconNoData(in mozIDOMWindowProxy aWindow);
|
||||
|
||||
/**
|
||||
* Whether the OS is currently in tablet mode. Always false on
|
||||
* non-Windows and on versions of Windows before win10
|
||||
|
@ -198,6 +198,20 @@ WindowsUIUtils::SetWindowIcon(mozIDOMWindowProxy* aWindow,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WindowsUIUtils::SetWindowIconNoData(mozIDOMWindowProxy* aWindow) {
|
||||
NS_ENSURE_ARG(aWindow);
|
||||
|
||||
nsCOMPtr<nsIWidget> widget =
|
||||
nsGlobalWindowOuter::Cast(aWindow)->GetMainWidget();
|
||||
nsWindow* window = static_cast<nsWindow*>(widget.get());
|
||||
|
||||
window->SetSmallIconNoData();
|
||||
window->SetBigIconNoData();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WindowsUIUtils::GetInTabletMode(bool* aResult) {
|
||||
if (mInTabletMode == eTabletModeUnknown) {
|
||||
|
@ -3869,6 +3869,18 @@ void nsWindow::SetIcon(const nsAString& aIconSpec) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void nsWindow::SetBigIconNoData() {
|
||||
HICON bigIcon =
|
||||
::LoadIconW(::GetModuleHandleW(nullptr), gStockApplicationIcon);
|
||||
SetBigIcon(bigIcon);
|
||||
}
|
||||
|
||||
void nsWindow::SetSmallIconNoData() {
|
||||
HICON smallIcon =
|
||||
::LoadIconW(::GetModuleHandleW(nullptr), gStockApplicationIcon);
|
||||
SetSmallIcon(smallIcon);
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* SECTION: nsIWidget::WidgetToScreenOffset
|
||||
|
@ -301,6 +301,8 @@ class nsWindow final : public nsWindowBase {
|
||||
|
||||
void SetSmallIcon(HICON aIcon);
|
||||
void SetBigIcon(HICON aIcon);
|
||||
void SetSmallIconNoData();
|
||||
void SetBigIconNoData();
|
||||
|
||||
static void SetIsRestoringSession(const bool aIsRestoringSession) {
|
||||
sIsRestoringSession = aIsRestoringSession;
|
||||
|
Loading…
x
Reference in New Issue
Block a user