mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge f-t to m-c
This commit is contained in:
commit
430f60a640
@ -18,8 +18,7 @@ var MetroDownloadsView = {
|
||||
_inited: false,
|
||||
_progressAlert: null,
|
||||
_lastSec: Infinity,
|
||||
_notificationBox: null,
|
||||
_progressNotification: null,
|
||||
|
||||
_progressNotificationInfo: new Map(),
|
||||
_runDownloadBooleanMap: new Map(),
|
||||
|
||||
@ -56,11 +55,12 @@ var MetroDownloadsView = {
|
||||
Services.obs.addObserver(this, "dl-run", true);
|
||||
Services.obs.addObserver(this, "dl-failed", true);
|
||||
|
||||
this._notificationBox = Browser.getNotificationBox();
|
||||
|
||||
this._progress = new DownloadProgressListener(this);
|
||||
this.manager.addListener(this._progress);
|
||||
|
||||
Elements.tabList.addEventListener("TabClose", this, false);
|
||||
|
||||
this._downloadProgressIndicator = document.getElementById("download-progress");
|
||||
|
||||
if (this.manager.activeDownloadCount) {
|
||||
@ -74,10 +74,54 @@ var MetroDownloadsView = {
|
||||
Services.obs.removeObserver(this, "dl-done");
|
||||
Services.obs.removeObserver(this, "dl-run");
|
||||
Services.obs.removeObserver(this, "dl-failed");
|
||||
if (Elements && Elements.tabList)
|
||||
Elements.tabList.removeEventListener("TabClose", this);
|
||||
}
|
||||
},
|
||||
|
||||
_restartWithActiveDownloads: function() {
|
||||
get _notificationBox() {
|
||||
return Browser.getNotificationBox(Browser.selectedBrowser);
|
||||
},
|
||||
|
||||
get _notificationBoxes() {
|
||||
let currentBox = this._notificationBox;
|
||||
let boxes = [
|
||||
currentBox
|
||||
];
|
||||
for (let { linkedBrowser } of Elements.tabList.children) {
|
||||
if (linkedBrowser !== Browser.selectedBrowser) {
|
||||
let notificationBox = Browser.getNotificationBox(linkedBrowser);
|
||||
if (notificationBox)
|
||||
boxes.push(notificationBox);
|
||||
}
|
||||
}
|
||||
return boxes;
|
||||
},
|
||||
|
||||
get _progressNotification() {
|
||||
let notn = this._getNotificationWithValue("download-progress");
|
||||
let currentBox = this._notificationBox;
|
||||
// move the progress notification if attached to a different browser
|
||||
if (notn && notn.parentNode !== currentBox) {
|
||||
notn.parentNode.removeNotification(notn);
|
||||
currentBox.insertBefore(notn, currentBox.firstChild);
|
||||
}
|
||||
return notn;
|
||||
},
|
||||
|
||||
_getNotificationWithValue: function(aValue) {
|
||||
let notn;
|
||||
let allNotificationBoxes = this._notificationBoxes;
|
||||
for(let box of allNotificationBoxes) {
|
||||
notn = box.getNotificationWithValue(aValue);
|
||||
if (notn) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return notn;
|
||||
},
|
||||
|
||||
_restartWithActiveDownloads: function() {
|
||||
let activeDownloads = this.manager.activeDownloads;
|
||||
|
||||
while (activeDownloads.hasMoreElements()) {
|
||||
@ -140,9 +184,9 @@ var MetroDownloadsView = {
|
||||
this._runDownloadBooleanMap.delete(aDownload.targetFile.path);
|
||||
this._downloadCount--;
|
||||
this._downloadsInProgress--;
|
||||
if (this._downloadsInProgress <= 0) {
|
||||
this._notificationBox.removeNotification(this._progressNotification);
|
||||
this._progressNotification = null;
|
||||
let notn = this._progressNotification;
|
||||
if (notn && this._downloadsInProgress <= 0) {
|
||||
this._notificationBox.removeNotification(notn);
|
||||
}
|
||||
} catch (ex) {
|
||||
Util.dumpLn("Failed to cancel download, with id: "+aDownload.id+", download target URI spec: " + fileURI.spec);
|
||||
@ -384,32 +428,35 @@ var MetroDownloadsView = {
|
||||
},
|
||||
|
||||
onDownloadButton: function dv_onDownloadButton() {
|
||||
if (this._downloadsInProgress) {
|
||||
if (!this._removeNotification("download-progress")) {
|
||||
this.updateInfobar();
|
||||
}
|
||||
} else if (this._downloadCount) {
|
||||
if (!this._removeNotification("download-complete")) {
|
||||
this._showDownloadCompleteNotification();
|
||||
}
|
||||
let progressNotification = this._getNotificationWithValue("download-progress");
|
||||
let wasProgressVisible = (progressNotification &&
|
||||
progressNotification.parentNode == this._notificationBox);
|
||||
let completeNotification = this._getNotificationWithValue("download-complete");
|
||||
let wasCompleteVisible = (completeNotification &&
|
||||
completeNotification.parentNode == this._notificationBox);
|
||||
|
||||
this._removeNotification("download-complete");
|
||||
this._removeNotification("download-progress");
|
||||
|
||||
if (this._downloadsInProgress && !wasProgressVisible) {
|
||||
this.updateInfobar();
|
||||
} else if (this._downloadCount && !wasCompleteVisible) {
|
||||
this._showDownloadCompleteNotification();
|
||||
}
|
||||
},
|
||||
|
||||
_removeNotification: function (aValue) {
|
||||
let notification = this._notificationBox.getNotificationWithValue(aValue);
|
||||
if (!notification) {
|
||||
return false;
|
||||
}
|
||||
this._notificationBox.removeNotification(notification);
|
||||
return true;
|
||||
let notification = this._getNotificationWithValue(aValue);
|
||||
return notification &&
|
||||
notification.parentNode.removeNotification(notification);
|
||||
},
|
||||
|
||||
updateInfobar: function dv_updateInfobar() {
|
||||
let message = this._computeDownloadProgressString();
|
||||
this._updateCircularProgressMeter();
|
||||
|
||||
if (this._progressNotification == null ||
|
||||
!this._notificationBox.getNotificationWithValue("download-progress")) {
|
||||
let notn = this._progressNotification;
|
||||
if (!notn) {
|
||||
let cancelButtonText =
|
||||
Strings.browser.GetStringFromName("downloadCancel");
|
||||
|
||||
@ -425,23 +472,23 @@ var MetroDownloadsView = {
|
||||
}
|
||||
];
|
||||
|
||||
this._progressNotification =
|
||||
this.showNotification("download-progress", message, buttons,
|
||||
this._notificationBox.PRIORITY_WARNING_LOW);
|
||||
notn = this.showNotification("download-progress", message, buttons,
|
||||
this._notificationBox.PRIORITY_WARNING_LOW);
|
||||
|
||||
ContextUI.displayNavbar();
|
||||
} else {
|
||||
this._progressNotification.label = message;
|
||||
notn.label = message;
|
||||
}
|
||||
},
|
||||
|
||||
updateDownload: function dv_updateDownload(aDownload) {
|
||||
if (this._progressNotification != null) {
|
||||
this._saveDownloadData(aDownload);
|
||||
this._progressNotification.label =
|
||||
this._saveDownloadData(aDownload);
|
||||
let notn = this._progressNotification;
|
||||
if (notn) {
|
||||
notn.label =
|
||||
this._computeDownloadProgressString(aDownload);
|
||||
this._updateCircularProgressMeter();
|
||||
}
|
||||
this._updateCircularProgressMeter();
|
||||
},
|
||||
|
||||
watchDownload: function dv_watchDownload(aDownload) {
|
||||
@ -486,8 +533,9 @@ var MetroDownloadsView = {
|
||||
this._showDownloadCompleteToast();
|
||||
this._showDownloadCompleteNotification();
|
||||
}
|
||||
this._notificationBox.removeNotification(this._progressNotification);
|
||||
this._progressNotification = null;
|
||||
let notn = this._progressNotification;
|
||||
if (notn)
|
||||
this._notificationBox.removeNotification(notn);
|
||||
}
|
||||
break;
|
||||
case "dl-failed":
|
||||
@ -497,6 +545,22 @@ var MetroDownloadsView = {
|
||||
}
|
||||
},
|
||||
|
||||
handleEvent: function(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case 'TabClose': {
|
||||
let browser = aEvent.originalTarget.linkedBrowser;
|
||||
dump("DownloadNotificationsView handleEvent, got TabClose event for browser: "+browser+"\n");
|
||||
let notn = this._getNotificationWithValue("download-progress");
|
||||
if (notn && notn.defaultView == browser.contentWindow) {
|
||||
let nextTab = Browser.getNextTab(aEvent.originalTarget);
|
||||
let box = Browser.getNotificationBox(nextTab.linkedBrowser);
|
||||
box.insertBefore(notn, box.firstChild);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
QueryInterface: function (aIID) {
|
||||
if (!aIID.equals(Ci.nsIObserver) &&
|
||||
!aIID.equals(Ci.nsISupportsWeakReference) &&
|
||||
|
@ -488,16 +488,16 @@
|
||||
color: #b6babf;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-left: 1px solid #42484f;
|
||||
-moz-border-start: 1px solid #42484f;
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
.devtools-tab:first-child {
|
||||
border-left-width: 0;
|
||||
-moz-border-start-width: 0;
|
||||
}
|
||||
|
||||
.devtools-tab:last-child {
|
||||
border-right: 1px solid #5a6169;
|
||||
-moz-border-end: 1px solid #42484f;
|
||||
}
|
||||
|
||||
.devtools-tab > image {
|
||||
@ -522,7 +522,7 @@
|
||||
}
|
||||
|
||||
.devtools-tab:active > image,
|
||||
.devtools-tab[selected=true] > label {
|
||||
.devtools-tab[selected=true] > image {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@ -546,12 +546,16 @@
|
||||
}
|
||||
|
||||
.devtools-tab[selected=true]:not(:first-child) {
|
||||
padding-left: 1px;
|
||||
-moz-padding-start: 1px;
|
||||
}
|
||||
|
||||
.devtools-tab[selected=true]:last-child {
|
||||
-moz-padding-end: 1px;
|
||||
}
|
||||
|
||||
.devtools-tab[selected=true] + .devtools-tab {
|
||||
border-left-width: 0;
|
||||
padding-left: 1px;
|
||||
-moz-border-start-width: 0;
|
||||
-moz-padding-start: 1px;
|
||||
}
|
||||
|
||||
.devtools-tab:not([selected=true]).highlighted {
|
||||
|
Loading…
Reference in New Issue
Block a user