browser/metro/components/DownloadManagerUI.js

changeset 2
7e26c7da4463
equal deleted inserted replaced
-1:000000000000 0:fb81282134c4
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/. */
4
5 const Ci = Components.interfaces;
6
7 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
8 Components.utils.import("resource://gre/modules/Services.jsm");
9
10 // -----------------------------------------------------------------------
11 // Download Manager UI
12 // -----------------------------------------------------------------------
13
14 function DownloadManagerUI() { }
15
16 DownloadManagerUI.prototype = {
17 classID: Components.ID("{93db15b1-b408-453e-9a2b-6619e168324a}"),
18
19 show: function show(aWindowContext, aID, aReason, aUsePrivateUI) {
20 if (!aReason)
21 aReason = Ci.nsIDownloadManagerUI.REASON_USER_INTERACTED;
22
23 let browser = Services.wm.getMostRecentWindow("navigator:browser");
24 if (browser)
25 browser.showDownloadManager(aWindowContext, aID, aReason);
26 },
27
28 get visible() {
29 // For now there is no Download Manager UI.
30 return false;
31 },
32
33 getAttention: function getAttention() {
34 if (this.visible)
35 this.show(null, null, null);
36 else
37 throw Cr.NS_ERROR_UNEXPECTED;
38 },
39
40 QueryInterface: XPCOMUtils.generateQI([Ci.nsIDownloadManagerUI])
41 };
42
43 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadManagerUI]);

mercurial