michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: const Ci = Components.interfaces; michael@0: michael@0: Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); michael@0: Components.utils.import("resource://gre/modules/Services.jsm"); michael@0: michael@0: // ----------------------------------------------------------------------- michael@0: // Download Manager UI michael@0: // ----------------------------------------------------------------------- michael@0: michael@0: function DownloadManagerUI() { } michael@0: michael@0: DownloadManagerUI.prototype = { michael@0: classID: Components.ID("{93db15b1-b408-453e-9a2b-6619e168324a}"), michael@0: michael@0: show: function show(aWindowContext, aID, aReason, aUsePrivateUI) { michael@0: if (!aReason) michael@0: aReason = Ci.nsIDownloadManagerUI.REASON_USER_INTERACTED; michael@0: michael@0: let browser = Services.wm.getMostRecentWindow("navigator:browser"); michael@0: if (browser) michael@0: browser.showDownloadManager(aWindowContext, aID, aReason); michael@0: }, michael@0: michael@0: get visible() { michael@0: // For now there is no Download Manager UI. michael@0: return false; michael@0: }, michael@0: michael@0: getAttention: function getAttention() { michael@0: if (this.visible) michael@0: this.show(null, null, null); michael@0: else michael@0: throw Cr.NS_ERROR_UNEXPECTED; michael@0: }, michael@0: michael@0: QueryInterface: XPCOMUtils.generateQI([Ci.nsIDownloadManagerUI]) michael@0: }; michael@0: michael@0: this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadManagerUI]);