Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 const Ci = Components.interfaces;
7 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
8 Components.utils.import("resource://gre/modules/Services.jsm");
10 // -----------------------------------------------------------------------
11 // Download Manager UI
12 // -----------------------------------------------------------------------
14 function DownloadManagerUI() { }
16 DownloadManagerUI.prototype = {
17 classID: Components.ID("{93db15b1-b408-453e-9a2b-6619e168324a}"),
19 show: function show(aWindowContext, aID, aReason, aUsePrivateUI) {
20 if (!aReason)
21 aReason = Ci.nsIDownloadManagerUI.REASON_USER_INTERACTED;
23 let browser = Services.wm.getMostRecentWindow("navigator:browser");
24 if (browser)
25 browser.showDownloadManager(aWindowContext, aID, aReason);
26 },
28 get visible() {
29 // For now there is no Download Manager UI.
30 return false;
31 },
33 getAttention: function getAttention() {
34 if (this.visible)
35 this.show(null, null, null);
36 else
37 throw Cr.NS_ERROR_UNEXPECTED;
38 },
40 QueryInterface: XPCOMUtils.generateQI([Ci.nsIDownloadManagerUI])
41 };
43 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadManagerUI]);