mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Backed out 4 changesets (bug 1751010) for win bustages on nsWindow.cpp. CLOSED TREE
Backed out changeset b68d86cc545d (bug 1751010) Backed out changeset b51b389bd0fd (bug 1751010) Backed out changeset f128c61e50eb (bug 1751010) Backed out changeset 1cbe75d59770 (bug 1751010)
This commit is contained in:
parent
6ea608fef7
commit
f064bd5377
@ -26,11 +26,18 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
ShellService: "resource:///modules/ShellService.jsm",
|
||||
UpdatePing: "resource://gre/modules/UpdatePing.jsm",
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetters(this, {
|
||||
UpdateManager: ["@mozilla.org/updates/update-manager;1", "nsIUpdateManager"],
|
||||
WinTaskbar: ["@mozilla.org/windows-taskbar;1", "nsIWinTaskbar"],
|
||||
WindowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
"WindowsUIUtils",
|
||||
"@mozilla.org/windows-ui-utils;1",
|
||||
"nsIWindowsUIUtils"
|
||||
);
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
"UpdateManager",
|
||||
"@mozilla.org/updates/update-manager;1",
|
||||
"nsIUpdateManager"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gSystemPrincipal", () =>
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
@ -41,11 +48,6 @@ 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) {
|
||||
if (aURI && !aURI.schemeIs("chrome")) {
|
||||
return true;
|
||||
@ -274,20 +276,6 @@ function openBrowserWindow(
|
||||
win.docShell.QueryInterface(
|
||||
Ci.nsILoadContext
|
||||
).usePrivateBrowsing = true;
|
||||
if (Services.prefs.getBoolPref(PRIVACY_SEGMENTATION_PREF)) {
|
||||
// TODO: Changing this after the Window has been painted causes it to
|
||||
// change Taskbar icons if the original one had a different AUMID.
|
||||
// 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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let openTime = win.openTime;
|
||||
|
@ -141,34 +141,52 @@ let privateWindowTask = {
|
||||
|
||||
// Implementation
|
||||
|
||||
var Builder = class {
|
||||
constructor(builder) {
|
||||
this._builder = builder;
|
||||
this._tasks = null;
|
||||
this._pendingStatements = {};
|
||||
this._shuttingDown = false;
|
||||
// These are ultimately controlled by prefs, so we disable
|
||||
// everything until is read from there
|
||||
this._showTasks = false;
|
||||
this._showFrequent = false;
|
||||
this._showRecent = false;
|
||||
this._maxItemCount = 0;
|
||||
}
|
||||
var WinTaskbarJumpList = {
|
||||
_builder: null,
|
||||
_tasks: null,
|
||||
_shuttingDown: false,
|
||||
|
||||
refreshPrefs(showTasks, showFrequent, showRecent, maxItemCount) {
|
||||
this._showTasks = showTasks;
|
||||
this._showFrequent = showFrequent;
|
||||
this._showRecent = showRecent;
|
||||
this._maxItemCount = maxItemCount;
|
||||
}
|
||||
/**
|
||||
* Startup, shutdown, and update
|
||||
*/
|
||||
|
||||
updateShutdownState(shuttingDown) {
|
||||
this._shuttingDown = shuttingDown;
|
||||
}
|
||||
startup: function WTBJL_startup() {
|
||||
// exit if this isn't win7 or higher.
|
||||
if (!this._initTaskbar()) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete() {
|
||||
delete this._builder;
|
||||
}
|
||||
// Store our task list config data
|
||||
this._tasks = tasksCfg;
|
||||
|
||||
if (PrivateBrowsingUtils.enabled) {
|
||||
tasksCfg.push(privateWindowTask);
|
||||
}
|
||||
|
||||
// retrieve taskbar related prefs.
|
||||
this._refreshPrefs();
|
||||
|
||||
// observer for private browsing and our prefs branch
|
||||
this._initObs();
|
||||
|
||||
// jump list refresh timer
|
||||
this._updateTimer();
|
||||
},
|
||||
|
||||
update: function WTBJL_update() {
|
||||
// are we disabled via prefs? don't do anything!
|
||||
if (!this._enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// do what we came here to do, update the taskbar jumplist
|
||||
this._buildList();
|
||||
},
|
||||
|
||||
_shutdown: function WTBJL__shutdown() {
|
||||
this._shuttingDown = true;
|
||||
this._free();
|
||||
},
|
||||
|
||||
/**
|
||||
* List building
|
||||
@ -180,15 +198,13 @@ var Builder = class {
|
||||
* commitBuild() will commit for real.
|
||||
*/
|
||||
|
||||
_hasPendingStatements() {
|
||||
_pendingStatements: {},
|
||||
_hasPendingStatements: function WTBJL__hasPendingStatements() {
|
||||
return !!Object.keys(this._pendingStatements).length;
|
||||
}
|
||||
},
|
||||
|
||||
async buildList() {
|
||||
if (
|
||||
(this._showFrequent || this._showRecent) &&
|
||||
this._hasPendingStatements()
|
||||
) {
|
||||
async _buildList() {
|
||||
if (this._hasPendingStatements()) {
|
||||
// We were requested to update the list while another update was in
|
||||
// progress, this could happen at shutdown, idle or privatebrowsing.
|
||||
// Abort the current list building.
|
||||
@ -222,7 +238,7 @@ var Builder = class {
|
||||
}
|
||||
|
||||
this._commitBuild();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Taskbar api wrappers
|
||||
@ -235,13 +251,10 @@ var Builder = class {
|
||||
// Prior to building, delete removed items from history.
|
||||
this._clearHistory(URIsToRemove);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_commitBuild() {
|
||||
if (
|
||||
(this._showFrequent || this._showRecent) &&
|
||||
this._hasPendingStatements()
|
||||
) {
|
||||
_commitBuild: function WTBJL__commitBuild() {
|
||||
if (this._hasPendingStatements()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -250,9 +263,9 @@ var Builder = class {
|
||||
this._builder.abortListBuild();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_buildTasks() {
|
||||
_buildTasks: function WTBJL__buildTasks() {
|
||||
var items = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
|
||||
this._tasks.forEach(function(task) {
|
||||
if (
|
||||
@ -277,9 +290,9 @@ var Builder = class {
|
||||
items
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_buildCustom(title, items) {
|
||||
_buildCustom: function WTBJL__buildCustom(title, items) {
|
||||
if (items.length) {
|
||||
this._builder.addListToBuild(
|
||||
this._builder.JUMPLIST_CATEGORY_CUSTOMLIST,
|
||||
@ -287,9 +300,9 @@ var Builder = class {
|
||||
title
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_buildFrequent() {
|
||||
_buildFrequent: function WTBJL__buildFrequent() {
|
||||
// Windows supports default frequent and recent lists,
|
||||
// but those depend on internal windows visit tracking
|
||||
// which we don't populate. So we build our own custom
|
||||
@ -326,9 +339,9 @@ var Builder = class {
|
||||
},
|
||||
this
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
_buildRecent() {
|
||||
_buildRecent: function WTBJL__buildRecent() {
|
||||
var items = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
|
||||
// Frequent items will be skipped, so we select a double amount of
|
||||
// entries and stop fetching results at _maxItemCount.
|
||||
@ -372,17 +385,23 @@ var Builder = class {
|
||||
},
|
||||
this
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
_deleteActiveJumpList() {
|
||||
_deleteActiveJumpList: function WTBJL__deleteAJL() {
|
||||
this._builder.deleteActiveList();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Jump list item creation helpers
|
||||
*/
|
||||
|
||||
_getHandlerAppItem(name, description, args, iconIndex, faviconPageUri) {
|
||||
_getHandlerAppItem: function WTBJL__getHandlerAppItem(
|
||||
name,
|
||||
description,
|
||||
args,
|
||||
iconIndex,
|
||||
faviconPageUri
|
||||
) {
|
||||
var file = Services.dirsvc.get("XREExeF", Ci.nsIFile);
|
||||
|
||||
var handlerApp = Cc[
|
||||
@ -403,13 +422,25 @@ var Builder = class {
|
||||
item.iconIndex = iconIndex;
|
||||
item.faviconPageUri = faviconPageUri;
|
||||
return item;
|
||||
}
|
||||
},
|
||||
|
||||
_getSeparatorItem: function WTBJL__getSeparatorItem() {
|
||||
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].createInstance(
|
||||
Ci.nsIJumpListSeparator
|
||||
);
|
||||
return item;
|
||||
},
|
||||
|
||||
/**
|
||||
* Nav history helpers
|
||||
*/
|
||||
|
||||
_getHistoryResults(aSortingMode, aLimit, aCallback, aScope) {
|
||||
_getHistoryResults: function WTBLJL__getHistoryResults(
|
||||
aSortingMode,
|
||||
aLimit,
|
||||
aCallback,
|
||||
aScope
|
||||
) {
|
||||
var options = PlacesUtils.history.getNewQueryOptions();
|
||||
options.maxResults = aLimit;
|
||||
options.sortingMode = aSortingMode;
|
||||
@ -433,12 +464,12 @@ var Builder = class {
|
||||
);
|
||||
},
|
||||
handleCompletion(aReason) {
|
||||
aCallback.call(aScope, null);
|
||||
aCallback.call(WinTaskbarJumpList, null);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_clearHistory(uriSpecsToRemove) {
|
||||
_clearHistory: function WTBJL__clearHistory(uriSpecsToRemove) {
|
||||
let URIsToRemove = uriSpecsToRemove
|
||||
.map(spec => {
|
||||
try {
|
||||
@ -453,61 +484,6 @@ var Builder = class {
|
||||
if (URIsToRemove.length) {
|
||||
PlacesUtils.history.remove(URIsToRemove).catch(Cu.reportError);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var WinTaskbarJumpList = {
|
||||
// We build two separate jump lists -- one for the regular Firefox icon
|
||||
// and one for the Private Browsing icon
|
||||
_builder: null,
|
||||
_pbBuilder: null,
|
||||
_shuttingDown: false,
|
||||
|
||||
/**
|
||||
* Startup, shutdown, and update
|
||||
*/
|
||||
|
||||
startup: function WTBJL_startup() {
|
||||
// exit if this isn't win7 or higher.
|
||||
if (!this._initTaskbar()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (PrivateBrowsingUtils.enabled) {
|
||||
tasksCfg.push(privateWindowTask);
|
||||
}
|
||||
// Store our task list config data
|
||||
this._builder._tasks = tasksCfg;
|
||||
this._pbBuilder._tasks = tasksCfg;
|
||||
|
||||
// retrieve taskbar related prefs.
|
||||
this._refreshPrefs();
|
||||
|
||||
// observer for private browsing and our prefs branch
|
||||
this._initObs();
|
||||
|
||||
// jump list refresh timer
|
||||
this._updateTimer();
|
||||
|
||||
// We only build the Private Browsing Jump List once
|
||||
this._pbBuilder.buildList();
|
||||
},
|
||||
|
||||
update: function WTBJL_update() {
|
||||
// are we disabled via prefs? don't do anything!
|
||||
if (!this._enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// do what we came here to do, update the taskbar jumplist
|
||||
this._builder.buildList();
|
||||
},
|
||||
|
||||
_shutdown: function WTBJL__shutdown() {
|
||||
this._builder.updateShutdownState(true);
|
||||
this._pbBuilder.updateShutdownState(true);
|
||||
this._shuttingDown = true;
|
||||
this._free();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -516,17 +492,10 @@ var WinTaskbarJumpList = {
|
||||
|
||||
_refreshPrefs: function WTBJL__refreshPrefs() {
|
||||
this._enabled = _prefs.getBoolPref(PREF_TASKBAR_ENABLED);
|
||||
var showTasks = _prefs.getBoolPref(PREF_TASKBAR_TASKS);
|
||||
this._builder.refreshPrefs(
|
||||
showTasks,
|
||||
_prefs.getBoolPref(PREF_TASKBAR_FREQUENT),
|
||||
_prefs.getBoolPref(PREF_TASKBAR_RECENT),
|
||||
_prefs.getIntPref(PREF_TASKBAR_ITEMCOUNT)
|
||||
);
|
||||
// showTasks is the only relevant pref for the Private Browsing Jump List
|
||||
// the others are are related to frequent/recent entries, which are
|
||||
// explicitly disabled for it
|
||||
this._pbBuilder.refreshPrefs(showTasks, false, false, 0);
|
||||
this._showFrequent = _prefs.getBoolPref(PREF_TASKBAR_FREQUENT);
|
||||
this._showRecent = _prefs.getBoolPref(PREF_TASKBAR_RECENT);
|
||||
this._showTasks = _prefs.getBoolPref(PREF_TASKBAR_TASKS);
|
||||
this._maxItemCount = _prefs.getIntPref(PREF_TASKBAR_ITEMCOUNT);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -534,15 +503,11 @@ var WinTaskbarJumpList = {
|
||||
*/
|
||||
|
||||
_initTaskbar: function WTBJL__initTaskbar() {
|
||||
var builder = _taskbarService.createJumpListBuilder(false);
|
||||
var pbBuilder = _taskbarService.createJumpListBuilder(true);
|
||||
if (!builder || !builder.available || !pbBuilder || !pbBuilder.available) {
|
||||
this._builder = _taskbarService.createJumpListBuilder();
|
||||
if (!this._builder || !this._builder.available) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._builder = new Builder(builder, true, true, true);
|
||||
this._pbBuilder = new Builder(pbBuilder, true, false, false);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
@ -606,8 +571,7 @@ var WinTaskbarJumpList = {
|
||||
this._freeObs();
|
||||
this._updateTimer();
|
||||
this._updateIdleObserver();
|
||||
this._builder.delete();
|
||||
this._pbBuilder.delete();
|
||||
delete this._builder;
|
||||
},
|
||||
|
||||
notify: function WTBJL_notify(aTimer) {
|
||||
|
@ -17,8 +17,6 @@
|
||||
#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
|
||||
|
@ -156,6 +156,4 @@ interface nsIJumpListBuilder : nsISupports
|
||||
* @throw NS_ERROR_UNEXPECTED on internal errors.
|
||||
*/
|
||||
boolean deleteActiveList();
|
||||
|
||||
void setAppUserModelID(in AString aAppUserModelId);
|
||||
};
|
||||
|
@ -66,12 +66,6 @@ interface nsIWinTaskbar : nsISupports
|
||||
*/
|
||||
readonly attribute AString defaultGroupId;
|
||||
|
||||
/**
|
||||
* Same as above, but a different value so that Private Browsing windows
|
||||
* can be separated in the Taskbar.
|
||||
*/
|
||||
readonly attribute AString defaultPrivateGroupId;
|
||||
|
||||
/**
|
||||
* Taskbar window and tab preview management
|
||||
*/
|
||||
@ -129,7 +123,7 @@ interface nsIWinTaskbar : nsISupports
|
||||
* @throw NS_ERROR_ALREADY_INITIALIZED if an nsIJumpListBuilder instance is
|
||||
* currently building a list.
|
||||
*/
|
||||
nsIJumpListBuilder createJumpListBuilder(in boolean aPrivateBrowsing);
|
||||
nsIJumpListBuilder createJumpListBuilder();
|
||||
|
||||
/**
|
||||
* Application window taskbar group settings
|
||||
|
@ -17,8 +17,6 @@ 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);
|
||||
|
||||
/**
|
||||
|
@ -107,8 +107,7 @@ struct nsWidgetInitData {
|
||||
mAlwaysOnTop(false),
|
||||
mPIPWindow(false),
|
||||
mFissionWindow(false),
|
||||
mResizable(false),
|
||||
mIsPrivate(false) {}
|
||||
mResizable(false) {}
|
||||
|
||||
nsWindowType mWindowType;
|
||||
nsBorderStyle mBorderStyle;
|
||||
@ -138,7 +137,6 @@ struct nsWidgetInitData {
|
||||
bool mFissionWindow;
|
||||
// True if the window is user-resizable.
|
||||
bool mResizable;
|
||||
bool mIsPrivate;
|
||||
};
|
||||
|
||||
#endif // nsWidgetInitData_h__
|
||||
|
@ -132,31 +132,21 @@ JumpListBuilder::JumpListBuilder()
|
||||
if (!jumpListMgr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// GetAppUserModelID can only be called once we're back on the main thread.
|
||||
nsString modelId;
|
||||
// MSIX packages explicitly do not support setting the appid from within
|
||||
// the app, as it is set in the package manifest instead.
|
||||
if (mozilla::widget::WinTaskbar::GetAppUserModelID(modelId) &&
|
||||
!mozilla::widget::WinUtils::HasPackageIdentity()) {
|
||||
jumpListMgr->SetAppID(modelId.get());
|
||||
}
|
||||
}
|
||||
|
||||
JumpListBuilder::~JumpListBuilder() {
|
||||
Preferences::RemoveObserver(this, kPrefTaskbarEnabled);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::SetAppUserModelID(
|
||||
const nsAString& aAppUserModelId) {
|
||||
if (!mJumpListMgr) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
RefPtr<ICustomDestinationList> jumpListMgr = mJumpListMgr;
|
||||
if (!jumpListMgr) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
mAppUserModelId.Assign(aAppUserModelId);
|
||||
// MSIX packages explicitly do not support setting the appid from within
|
||||
// the app, as it is set in the package manifest instead.
|
||||
if (!mozilla::widget::WinUtils::HasPackageIdentity()) {
|
||||
jumpListMgr->SetAppID(mAppUserModelId.get());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::GetAvailable(int16_t* aAvailable) {
|
||||
*aAvailable = false;
|
||||
|
||||
@ -524,12 +514,15 @@ NS_IMETHODIMP JumpListBuilder::DeleteActiveList(bool* _retval) {
|
||||
AbortListBuild();
|
||||
}
|
||||
|
||||
nsAutoString uid;
|
||||
if (!WinTaskbar::GetAppUserModelID(uid)) return NS_OK;
|
||||
|
||||
RefPtr<ICustomDestinationList> jumpListMgr = mJumpListMgr;
|
||||
if (!jumpListMgr) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (SUCCEEDED(jumpListMgr->DeleteList(mAppUserModelId.get()))) {
|
||||
if (SUCCEEDED(jumpListMgr->DeleteList(uid.get()))) {
|
||||
*_retval = true;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,6 @@ class JumpListBuilder : public nsIJumpListBuilder, public nsIObserver {
|
||||
bool mHasCommit;
|
||||
nsCOMPtr<nsIThread> mIOThread;
|
||||
ReentrantMonitor mMonitor;
|
||||
nsString mAppUserModelId;
|
||||
|
||||
bool IsSeparator(nsCOMPtr<nsIJumpListItem>& item);
|
||||
void RemoveIconCacheAndGetJumplistShortcutURIs(IObjectArray* aObjArray,
|
||||
|
@ -5,7 +5,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIWinTaskbar.h"
|
||||
#include "WinTaskbar.h"
|
||||
#include "TaskbarPreview.h"
|
||||
#include <nsITaskbarPreviewController.h>
|
||||
@ -204,8 +203,14 @@ WinTaskbar::~WinTaskbar() {
|
||||
}
|
||||
|
||||
// static
|
||||
bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId,
|
||||
bool aPrivateBrowsing) {
|
||||
bool WinTaskbar::GetAppUserModelID(nsAString& aDefaultGroupId) {
|
||||
// If an ID has already been set then use that.
|
||||
PWSTR id;
|
||||
if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(&id))) {
|
||||
aDefaultGroupId.Assign(id);
|
||||
CoTaskMemFree(id);
|
||||
}
|
||||
|
||||
// If marked as such in prefs, use a hash of the profile path for the id
|
||||
// instead of the install path hash setup by the installer.
|
||||
bool useProfile = Preferences::GetBool("taskbar.grouping.useprofile", false);
|
||||
@ -220,7 +225,7 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId,
|
||||
nsAutoString id;
|
||||
id.AppendInt(HashString(path));
|
||||
if (!id.IsEmpty()) {
|
||||
aAppUserModelId.Assign(id);
|
||||
aDefaultGroupId.Assign(id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -252,10 +257,10 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId,
|
||||
wchar_t buf[256];
|
||||
if (WinUtils::GetRegistryKey(HKEY_LOCAL_MACHINE, regKey.get(), path, buf,
|
||||
sizeof buf)) {
|
||||
aAppUserModelId.Assign(buf);
|
||||
aDefaultGroupId.Assign(buf);
|
||||
} else if (WinUtils::GetRegistryKey(HKEY_CURRENT_USER, regKey.get(), path,
|
||||
buf, sizeof buf)) {
|
||||
aAppUserModelId.Assign(buf);
|
||||
aDefaultGroupId.Assign(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -263,28 +268,11 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId,
|
||||
// If we haven't found an ID yet then use the install hash. In xpcshell tests
|
||||
// the directory provider may not have been initialized so bypass in this
|
||||
// case.
|
||||
if (aAppUserModelId.IsEmpty() && gDirServiceProvider) {
|
||||
gDirServiceProvider->GetInstallHash(aAppUserModelId);
|
||||
if (aDefaultGroupId.IsEmpty() && gDirServiceProvider) {
|
||||
gDirServiceProvider->GetInstallHash(aDefaultGroupId);
|
||||
}
|
||||
|
||||
if (aPrivateBrowsing) {
|
||||
aAppUserModelId.AppendLiteral(";PrivateBrowsingAUMID");
|
||||
}
|
||||
|
||||
return !aAppUserModelId.IsEmpty();
|
||||
}
|
||||
|
||||
// static
|
||||
bool WinTaskbar::GetAppUserModelID(nsAString& aAppUserModelId,
|
||||
bool aPrivateBrowsing) {
|
||||
// If an ID has already been set then use that.
|
||||
PWSTR id;
|
||||
if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(&id))) {
|
||||
aAppUserModelId.Assign(id);
|
||||
CoTaskMemFree(id);
|
||||
}
|
||||
|
||||
return GenerateAppUserModelID(aAppUserModelId, aPrivateBrowsing);
|
||||
return !aDefaultGroupId.IsEmpty();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -294,14 +282,6 @@ WinTaskbar::GetDefaultGroupId(nsAString& aDefaultGroupId) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WinTaskbar::GetDefaultPrivateGroupId(nsAString& aDefaultPrivateGroupId) {
|
||||
if (!GetAppUserModelID(aDefaultPrivateGroupId, true))
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// (static) Called from AppShell
|
||||
bool WinTaskbar::RegisterAppUserModelID() {
|
||||
nsAutoString uid;
|
||||
@ -407,8 +387,7 @@ WinTaskbar::GetOverlayIconController(
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WinTaskbar::CreateJumpListBuilder(bool aPrivateBrowsing,
|
||||
nsIJumpListBuilder** aJumpListBuilder) {
|
||||
WinTaskbar::CreateJumpListBuilder(nsIJumpListBuilder** aJumpListBuilder) {
|
||||
nsresult rv;
|
||||
|
||||
if (JumpListBuilder::sBuildingList) return NS_ERROR_ALREADY_INITIALIZED;
|
||||
@ -419,10 +398,6 @@ WinTaskbar::CreateJumpListBuilder(bool aPrivateBrowsing,
|
||||
|
||||
NS_IF_ADDREF(*aJumpListBuilder = builder);
|
||||
|
||||
nsAutoString aumid;
|
||||
GenerateAppUserModelID(aumid, aPrivateBrowsing);
|
||||
builder->SetAppUserModelID(aumid);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -26,13 +26,10 @@ class WinTaskbar final : public nsIWinTaskbar {
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIWINTASKBAR
|
||||
|
||||
static bool GenerateAppUserModelID(nsAString& aAppUserModelId,
|
||||
bool aPrivateBrowsing = false);
|
||||
// Registers the global app user model id for the instance.
|
||||
// See comments in WinTaskbar.cpp for more information.
|
||||
static bool RegisterAppUserModelID();
|
||||
static bool GetAppUserModelID(nsAString& aDefaultGroupId,
|
||||
bool aPrivateBrowsing = false);
|
||||
static bool GetAppUserModelID(nsAString& aDefaultGroupId);
|
||||
|
||||
private:
|
||||
bool Initialize();
|
||||
|
@ -198,23 +198,6 @@ 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);
|
||||
|
@ -86,8 +86,6 @@
|
||||
#include <unknwn.h>
|
||||
#include <psapi.h>
|
||||
#include <rpc.h>
|
||||
#include <propvarutil.h>
|
||||
#include <propkey.h>
|
||||
|
||||
#include "mozilla/Logging.h"
|
||||
#include "prtime.h"
|
||||
@ -157,7 +155,6 @@
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/StaticPrefs_gfx.h"
|
||||
#include "mozilla/StaticPrefs_layout.h"
|
||||
#include "nsNativeAppSupportWin.h"
|
||||
|
||||
#include "nsIGfxInfo.h"
|
||||
#include "nsUXThemeConstants.h"
|
||||
@ -1028,32 +1025,6 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aInitData->mIsPrivate) {
|
||||
if (Preferences::GetBool("browser.privacySegmentation.enabled", false)) {
|
||||
RefPtr<IPropertyStore> pPropStore;
|
||||
if (!FAILED(SHGetPropertyStoreForWindow(mWnd, IID_IPropertyStore,
|
||||
getter_AddRefs(pPropStore)))) {
|
||||
PROPVARIANT pv;
|
||||
nsAutoString aumid;
|
||||
// make sure we're using the private browsing AUMID so that taskbar
|
||||
// grouping works properly
|
||||
NS_WARN_IF(
|
||||
!mozilla::widget::WinTaskbar::GenerateAppUserModelID(aumid, true));
|
||||
if (!FAILED(InitPropVariantFromString(aumid.get(), &pv))) {
|
||||
if (!FAILED(pPropStore->SetValue(PKEY_AppUserModel_ID, pv))) {
|
||||
pPropStore->Commit();
|
||||
}
|
||||
|
||||
PropVariantClear(&pv);
|
||||
}
|
||||
}
|
||||
}
|
||||
HICON icon =
|
||||
::LoadIconW(::GetModuleHandleW(nullptr), MAKEINTRESOURCEW(IDI_PBMODE));
|
||||
SetBigIcon(icon);
|
||||
SetSmallIcon(icon);
|
||||
}
|
||||
|
||||
mDeviceNotifyHandle = InputDeviceUtils::RegisterNotification(mWnd);
|
||||
|
||||
// If mDefaultScale is set before mWnd has been set, it will have the scale of
|
||||
|
@ -710,10 +710,6 @@ nsresult nsAppShellService::JustCreateTopWindow(
|
||||
|
||||
widgetInitData.mRTL = LocaleService::GetInstance()->IsAppLocaleRTL();
|
||||
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW) {
|
||||
widgetInitData.mIsPrivate = true;
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
window->Initialize(parent, center ? aParent : nullptr, aInitialWidth,
|
||||
aInitialHeight, aIsHiddenWindow, widgetInitData);
|
||||
|
Loading…
Reference in New Issue
Block a user