browser/metro/components/DownloadManagerUI.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/metro/components/DownloadManagerUI.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +const Ci = Components.interfaces;
     1.9 +
    1.10 +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
    1.11 +Components.utils.import("resource://gre/modules/Services.jsm");
    1.12 +
    1.13 +// -----------------------------------------------------------------------
    1.14 +// Download Manager UI
    1.15 +// -----------------------------------------------------------------------
    1.16 +
    1.17 +function DownloadManagerUI() { }
    1.18 +
    1.19 +DownloadManagerUI.prototype = {
    1.20 +  classID: Components.ID("{93db15b1-b408-453e-9a2b-6619e168324a}"),
    1.21 +
    1.22 +  show: function show(aWindowContext, aID, aReason, aUsePrivateUI) {
    1.23 +    if (!aReason)
    1.24 +      aReason = Ci.nsIDownloadManagerUI.REASON_USER_INTERACTED;
    1.25 +
    1.26 +    let browser = Services.wm.getMostRecentWindow("navigator:browser");
    1.27 +    if (browser)
    1.28 +      browser.showDownloadManager(aWindowContext, aID, aReason);
    1.29 +  },
    1.30 +
    1.31 +  get visible() {
    1.32 +    // For now there is no Download Manager UI.
    1.33 +    return false;
    1.34 +  },
    1.35 +
    1.36 +  getAttention: function getAttention() {
    1.37 +    if (this.visible)
    1.38 +      this.show(null, null, null);
    1.39 +    else
    1.40 +      throw Cr.NS_ERROR_UNEXPECTED;
    1.41 +  },
    1.42 +
    1.43 +  QueryInterface: XPCOMUtils.generateQI([Ci.nsIDownloadManagerUI])
    1.44 +};
    1.45 +
    1.46 +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadManagerUI]);

mercurial