зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1751010: Use a unique icon for the Private Browsing taskbar pin r=mhowell
This is subject to the same issue as an earlier patch in this series -- the icon will be wrong briefly at first launch, before the code in `BrowserContentHandler.jsm` replaces the default icon with the correct one. Differential Revision: https://phabricator.services.mozilla.com/D138601
This commit is contained in:
Родитель
98c5bfc44e
Коммит
1372e7f612
|
@ -41,6 +41,9 @@ XPCOMUtils.defineLazyGlobalGetters(this, [URL]);
|
|||
const ONCE_DOMAINS = ["mozilla.org", "firefox.com"];
|
||||
const ONCE_PREF = "browser.startup.homepage_override.once";
|
||||
|
||||
// Index of Private Browsing icon in firefox.exe
|
||||
// Must line up with the one in nsNativeAppSupportWin.h.
|
||||
const PRIVATE_BROWSING_ICON_INDEX = 5;
|
||||
const PRIVACY_SEGMENTATION_PREF = "browser.privacySegmentation.enabled";
|
||||
|
||||
function shouldLoadURI(aURI) {
|
||||
|
@ -277,6 +280,13 @@ function openBrowserWindow(
|
|||
// This must stay pref'ed off until this is resolved.
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1751010
|
||||
WinTaskbar.setGroupIdForWindow(win, WinTaskbar.defaultPrivateGroupId);
|
||||
WindowsUIUtils.setWindowIconFromExe(
|
||||
win,
|
||||
Services.dirsvc.get("XREExeF", Ci.nsIFile).path,
|
||||
// This corresponds to the definitions in
|
||||
// nsNativeAppSupportWin.h
|
||||
PRIVATE_BROWSING_ICON_INDEX
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#define IDI_DOCUMENT 2
|
||||
#define IDI_NEWWINDOW 3
|
||||
#define IDI_NEWTAB 4
|
||||
// If IDI_PBMODE's index changes, PRIVATE_BROWSING_ICON_INDEX
|
||||
// in BrowserContentHandler.jsm must also be updated.
|
||||
#define IDI_PBMODE 5
|
||||
#ifndef IDI_APPLICATION
|
||||
# define IDI_APPLICATION 32512
|
||||
|
|
|
@ -17,6 +17,8 @@ interface nsIWindowsUIUtils : nsISupports
|
|||
|
||||
void setWindowIcon(in mozIDOMWindowProxy aWindow, in imgIContainer aSmallIcon, in imgIContainer aLargeIcon);
|
||||
|
||||
void setWindowIconFromExe(in mozIDOMWindowProxy aWindow, in AString aExe, in unsigned short aIndex);
|
||||
|
||||
void setWindowIconNoData(in mozIDOMWindowProxy aWindow);
|
||||
|
||||
/**
|
||||
|
|
|
@ -198,6 +198,23 @@ WindowsUIUtils::SetWindowIcon(mozIDOMWindowProxy* aWindow,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WindowsUIUtils::SetWindowIconFromExe(mozIDOMWindowProxy* aWindow,
|
||||
const nsAString& aExe, uint16_t aIndex) {
|
||||
NS_ENSURE_ARG(aWindow);
|
||||
|
||||
nsCOMPtr<nsIWidget> widget =
|
||||
nsGlobalWindowOuter::Cast(aWindow)->GetMainWidget();
|
||||
nsWindow* window = static_cast<nsWindow*>(widget.get());
|
||||
|
||||
HICON icon = ::LoadIconW(::GetModuleHandleW(PromiseFlatString(aExe).get()),
|
||||
MAKEINTRESOURCEW(aIndex));
|
||||
window->SetBigIcon(icon);
|
||||
window->SetSmallIcon(icon);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WindowsUIUtils::SetWindowIconNoData(mozIDOMWindowProxy* aWindow) {
|
||||
NS_ENSURE_ARG(aWindow);
|
||||
|
|
|
@ -158,6 +158,7 @@
|
|||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/StaticPrefs_gfx.h"
|
||||
#include "mozilla/StaticPrefs_layout.h"
|
||||
#include "nsNativeAppSupportWin.h"
|
||||
|
||||
#include "nsIGfxInfo.h"
|
||||
#include "nsUXThemeConstants.h"
|
||||
|
@ -994,6 +995,10 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
|||
}
|
||||
}
|
||||
}
|
||||
HICON icon =
|
||||
::LoadIconW(::GetModuleHandleW(nullptr), MAKEINTRESOURCEW(IDI_PBMODE));
|
||||
SetBigIcon(icon);
|
||||
SetSmallIcon(icon);
|
||||
}
|
||||
|
||||
mDeviceNotifyHandle = InputDeviceUtils::RegisterNotification(mWnd);
|
||||
|
|
Загрузка…
Ссылка в новой задаче