mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 875731 - Replace callers of nsIDownloadManager.usersDownloadsDirectory with Downloads.getUserDownloadsDirectory mobile/andriod/. r=mfinkle
This commit is contained in:
parent
1ea13efb61
commit
bff6374217
@ -13,6 +13,11 @@ const URI_GENERIC_ICON_DOWNLOAD = "drawable://alert_download";
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
|
||||
"resource://gre/modules/Downloads.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// HelperApp Launcher Dialog
|
||||
// -----------------------------------------------------------------------
|
||||
@ -30,15 +35,16 @@ HelperAppLauncherDialog.prototype = {
|
||||
},
|
||||
|
||||
promptForSaveToFile: function hald_promptForSaveToFile(aLauncher, aContext, aDefaultFile, aSuggestedFileExt, aForcePrompt) {
|
||||
// Retrieve the user's default download directory
|
||||
let dnldMgr = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
|
||||
let defaultFolder = dnldMgr.userDownloadsDirectory;
|
||||
return Task.spawn(function() {
|
||||
// Retrieve the user's default download directory
|
||||
let defaultFolder = yield Downloads.getPreferredDownloadsDirectory();
|
||||
|
||||
try {
|
||||
file = this.validateLeafName(defaultFolder, aDefaultFile, aSuggestedFileExt);
|
||||
} catch (e) { }
|
||||
try {
|
||||
file = this.validateLeafName(defaultFolder, aDefaultFile, aSuggestedFileExt);
|
||||
} catch (e) { }
|
||||
|
||||
return file;
|
||||
throw new Task.Result(file);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
validateLeafName: function hald_validateLeafName(aLocalFile, aLeafName, aFileExt) {
|
||||
|
Loading…
Reference in New Issue
Block a user