summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-02-07 10:57:04 +0100
committerGitHub <noreply@github.com>2020-02-07 10:57:04 +0100
commit6c82d043a1fbcda650057467ae2858025290ed25 (patch)
tree0e6ed8ca0a0d12653351c67d8de62a372c954f29 /toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm
parenta6ef90b1830e263fefda7bcb6e7b74464044a678 (diff)
parentfa52fa60b70c5883acd4a8edd8e1f89c3d5f3920 (diff)
downloadUXP-6c82d043a1fbcda650057467ae2858025290ed25.tar
UXP-6c82d043a1fbcda650057467ae2858025290ed25.tar.gz
UXP-6c82d043a1fbcda650057467ae2858025290ed25.tar.lz
UXP-6c82d043a1fbcda650057467ae2858025290ed25.tar.xz
UXP-6c82d043a1fbcda650057467ae2858025290ed25.zip
Merge pull request #1394 from MoonchildProductions/appconst-work
The rest of removing AppConstants for Platform
Diffstat (limited to 'toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm')
-rw-r--r--toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm68
1 files changed, 34 insertions, 34 deletions
diff --git a/toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm b/toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm
index bccbeda56..e015ded2a 100644
--- a/toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm
+++ b/toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm
@@ -16,7 +16,6 @@ const Cu = Components.utils;
const Cr = Components.results;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
@@ -177,33 +176,33 @@ var DownloadTaskbarProgressUpdater =
*/
_setActiveWindow: function DTPU_setActiveWindow(aWindow, aIsDownloadWindow)
{
- if (AppConstants.platform == "win") {
- // Clear out the taskbar for the old active window. (If there was no active
- // window, this is a no-op.)
- this._clearTaskbar();
-
- this._activeWindowIsDownloadWindow = aIsDownloadWindow;
- if (aWindow) {
- // Get the taskbar progress for this window
- let docShell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
- getInterface(Ci.nsIWebNavigation).
- QueryInterface(Ci.nsIDocShellTreeItem).treeOwner.
- QueryInterface(Ci.nsIInterfaceRequestor).
- getInterface(Ci.nsIXULWindow).docShell;
- let taskbarProgress = this._taskbar.getTaskbarProgress(docShell);
- this._activeTaskbarProgress = taskbarProgress;
-
- this._updateTaskbar();
- // _onActiveWindowUnload is idempotent, so we don't need to check whether
- // we've already set this before or not.
- aWindow.addEventListener("unload", function () {
- DownloadTaskbarProgressUpdater._onActiveWindowUnload(taskbarProgress);
- }, false);
- }
- else {
- this._activeTaskbarProgress = null;
- }
+#ifdef XP_WIN
+ // Clear out the taskbar for the old active window. (If there was no active
+ // window, this is a no-op.)
+ this._clearTaskbar();
+
+ this._activeWindowIsDownloadWindow = aIsDownloadWindow;
+ if (aWindow) {
+ // Get the taskbar progress for this window
+ let docShell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
+ getInterface(Ci.nsIWebNavigation).
+ QueryInterface(Ci.nsIDocShellTreeItem).treeOwner.
+ QueryInterface(Ci.nsIInterfaceRequestor).
+ getInterface(Ci.nsIXULWindow).docShell;
+ let taskbarProgress = this._taskbar.getTaskbarProgress(docShell);
+ this._activeTaskbarProgress = taskbarProgress;
+
+ this._updateTaskbar();
+ // _onActiveWindowUnload is idempotent, so we don't need to check whether
+ // we've already set this before or not.
+ aWindow.addEventListener("unload", function () {
+ DownloadTaskbarProgressUpdater._onActiveWindowUnload(taskbarProgress);
+ }, false);
+ }
+ else {
+ this._activeTaskbarProgress = null;
}
+#endif
},
// / Current state displayed on the active window's taskbar item
@@ -213,14 +212,15 @@ var DownloadTaskbarProgressUpdater =
_shouldSetState: function DTPU_shouldSetState()
{
- if (AppConstants.platform == "win") {
- // If the active window is not the download manager window, set the state
- // only if it is normal or indeterminate.
- return this._activeWindowIsDownloadWindow ||
- (this._taskbarState == Ci.nsITaskbarProgress.STATE_NORMAL ||
- this._taskbarState == Ci.nsITaskbarProgress.STATE_INDETERMINATE);
- }
+#ifdef XP_WIN
+ // If the active window is not the download manager window, set the state
+ // only if it is normal or indeterminate.
+ return this._activeWindowIsDownloadWindow ||
+ (this._taskbarState == Ci.nsITaskbarProgress.STATE_NORMAL ||
+ this._taskbarState == Ci.nsITaskbarProgress.STATE_INDETERMINATE);
+#else
return true;
+#endif
},
/**