mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 810208 - Show the private download manager UI when clicking on the notification alert after a private download finishes; r=mak sr=gavin
This commit is contained in:
parent
c32dc4b9e4
commit
6744820571
@ -60,10 +60,10 @@ DownloadsUI.prototype = {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// nsIDownloadManagerUI
|
||||
|
||||
show: function DUI_show(aWindowContext, aID, aReason)
|
||||
show: function DUI_show(aWindowContext, aID, aReason, aUsePrivateUI)
|
||||
{
|
||||
if (DownloadsCommon.useToolkitUI) {
|
||||
this._toolkitUI.show(aWindowContext, aID, aReason);
|
||||
this._toolkitUI.show(aWindowContext, aID, aReason, aUsePrivateUI);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -76,19 +76,19 @@ DownloadsUI.prototype = {
|
||||
let browserWin = gBrowserGlue.getMostRecentBrowserWindow();
|
||||
|
||||
if (!browserWin || browserWin.windowState == kMinimized) {
|
||||
this._showDownloadManagerUI(aWindowContext, aID, aReason);
|
||||
this._showDownloadManagerUI(aWindowContext, aID, aReason, aUsePrivateUI);
|
||||
}
|
||||
else {
|
||||
// If the indicator is visible, then new download notifications are
|
||||
// already handled by the panel service.
|
||||
browserWin.DownloadsButton.checkIsVisible(function(isVisible) {
|
||||
if (!isVisible) {
|
||||
this._showDownloadManagerUI(aWindowContext, aID, aReason);
|
||||
this._showDownloadManagerUI(aWindowContext, aID, aReason, aUsePrivateUI);
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
} else {
|
||||
this._showDownloadManagerUI(aWindowContext, aID, aReason);
|
||||
this._showDownloadManagerUI(aWindowContext, aID, aReason, aUsePrivateUI);
|
||||
}
|
||||
},
|
||||
|
||||
@ -112,13 +112,13 @@ DownloadsUI.prototype = {
|
||||
* Helper function that opens the download manager UI.
|
||||
*/
|
||||
_showDownloadManagerUI:
|
||||
function DUI_showDownloadManagerUI(aWindowContext, aID, aReason)
|
||||
function DUI_showDownloadManagerUI(aWindowContext, aID, aReason, aUsePrivateUI)
|
||||
{
|
||||
// If we weren't given a window context, try to find a browser window
|
||||
// to use as our parent - and if that doesn't work, error out and give up.
|
||||
let parentWindow = aWindowContext;
|
||||
if (!parentWindow) {
|
||||
parentWindow = RecentWindow.getMostRecentBrowserWindow();
|
||||
parentWindow = RecentWindow.getMostRecentBrowserWindow({ private: !!aUsePrivateUI });
|
||||
if (!parentWindow) {
|
||||
Components.utils.reportError(
|
||||
"Couldn't find a browser window to open the Places Downloads View " +
|
||||
|
@ -16,7 +16,7 @@ function DownloadManagerUI() { }
|
||||
DownloadManagerUI.prototype = {
|
||||
classID: Components.ID("{93db15b1-b408-453e-9a2b-6619e168324a}"),
|
||||
|
||||
show: function show(aWindowContext, aID, aReason) {
|
||||
show: function show(aWindowContext, aID, aReason, aUsePrivateUI) {
|
||||
if (!aReason)
|
||||
aReason = Ci.nsIDownloadManagerUI.REASON_USER_INTERACTED;
|
||||
|
||||
|
@ -16,7 +16,7 @@ function DownloadManagerUI() { }
|
||||
DownloadManagerUI.prototype = {
|
||||
classID: Components.ID("{93db15b1-b408-453e-9a2b-6619e168324a}"),
|
||||
|
||||
show: function show(aWindowContext, aID, aReason) {
|
||||
show: function show(aWindowContext, aID, aReason, aUsePrivateUI) {
|
||||
if (!aReason)
|
||||
aReason = Ci.nsIDownloadManagerUI.REASON_USER_INTERACTED;
|
||||
|
||||
|
@ -2479,12 +2479,11 @@ nsDownloadManager::Observe(nsISupports *aSubject,
|
||||
(void)ResumeAllDownloads(false);
|
||||
}
|
||||
else if (strcmp(aTopic, "alertclickcallback") == 0) {
|
||||
//TODO: This doens't make sense when clicking a notification related to
|
||||
// private downloads when per-window mode is enabled. (bug 810208)
|
||||
nsCOMPtr<nsIDownloadManagerUI> dmui =
|
||||
do_GetService("@mozilla.org/download-manager-ui;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return dmui->Show(nullptr, 0, nsIDownloadManagerUI::REASON_USER_INTERACTED);
|
||||
return dmui->Show(nullptr, 0, nsIDownloadManagerUI::REASON_USER_INTERACTED,
|
||||
NS_strcmp(aData, NS_LITERAL_STRING("private").get()) == 0);
|
||||
} else if (strcmp(aTopic, "sleep_notification") == 0 ||
|
||||
strcmp(aTopic, "suspend_process_notification") == 0) {
|
||||
// Pause downloads if we're sleeping, and mark the downloads as auto-resume
|
||||
@ -2776,8 +2775,9 @@ nsDownload::SetState(DownloadState aState)
|
||||
// the items they downloaded will have been removed.
|
||||
alerts->ShowAlertNotification(
|
||||
NS_LITERAL_STRING(DOWNLOAD_MANAGER_ALERT_ICON), title,
|
||||
message, !removeWhenDone, EmptyString(), mDownloadManager,
|
||||
EmptyString());
|
||||
message, !removeWhenDone,
|
||||
mPrivate ? NS_LITERAL_STRING("private") : NS_LITERAL_STRING("non-private"),
|
||||
mDownloadManager, EmptyString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ nsDownloadManagerUI.prototype = {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// nsIDownloadManagerUI
|
||||
|
||||
show: function show(aWindowContext, aID, aReason)
|
||||
show: function show(aWindowContext, aID, aReason, aUsePrivateUI)
|
||||
{
|
||||
if (!aReason)
|
||||
aReason = Ci.nsIDownloadManagerUI.REASON_USER_INTERACTED;
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
if (visible && !focusWhenStarting)
|
||||
return NS_OK;
|
||||
|
||||
return dmui->Show(nullptr, id, nsIDownloadManagerUI::REASON_NEW_DOWNLOAD);
|
||||
return dmui->Show(nullptr, id, nsIDownloadManagerUI::REASON_NEW_DOWNLOAD, aIsPrivate);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "nsISupports.idl"
|
||||
interface nsIInterfaceRequestor;
|
||||
|
||||
[scriptable, uuid(ca7663d5-69e3-4c4a-b754-f462bd36b05f)]
|
||||
[scriptable, uuid(bc54ef90-5215-11e2-bcfd-0800200c9a66)]
|
||||
interface nsIDownloadManagerUI : nsISupports {
|
||||
/**
|
||||
* The reason that should be passed when the user requests to show the
|
||||
@ -30,10 +30,14 @@ interface nsIDownloadManagerUI : nsISupports {
|
||||
* The reason to show the download manager's UI. This defaults to
|
||||
* REASON_USER_INTERACTED, and should be one of the previously listed
|
||||
* constants.
|
||||
* @param [optional] aUsePrivateUI
|
||||
* Pass true as this argument to hint to the implementation that it
|
||||
* should only display private downloads in the UI, if possible.
|
||||
*/
|
||||
void show([optional] in nsIInterfaceRequestor aWindowContext,
|
||||
[optional] in unsigned long aID,
|
||||
[optional] in short aReason);
|
||||
[optional] in short aReason,
|
||||
[optional] in boolean aUsePrivateUI);
|
||||
|
||||
/**
|
||||
* Indicates if the UI is visible or not.
|
||||
|
@ -58,7 +58,7 @@ function HelperAppDlg() { }
|
||||
HelperAppDlg.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIHelperAppLauncherDialog]),
|
||||
contractID: "@mozilla.org/helperapplauncherdialog;1",
|
||||
show: function (launcher, ctx, reason) {
|
||||
show: function (launcher, ctx, reason, usePrivateUI) {
|
||||
launcher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.saveToFile;
|
||||
launcher.launchWithApplication(null, false);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user