Bug 815352 (Part 2) - Add a stub view to implement in-content downloads.
authorAsaf Romano <aromano@mozilla.com>
Thu, 20 Dec 2012 21:20:18 +0100
changeset 125809 8881a95c8b2d4c51d3a57bb008809fc3c7d16845
parent 125808 ce34fa2b21891e6ed4134981abdf085f054be7c9
child 125810 76634f2005ba386bb09a8f037a4202cd3392b56e
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs815352
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 815352 (Part 2) - Add a stub view to implement in-content downloads. r=mak
browser/components/downloads/content/allDownloadsViewOverlay.js
browser/components/downloads/content/allDownloadsViewOverlay.xul
browser/components/downloads/content/contentAreaDownloadsView.js
browser/components/downloads/content/contentAreaDownloadsView.xul
browser/components/downloads/jar.mn
--- a/browser/components/downloads/content/allDownloadsViewOverlay.js
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.js
@@ -11,16 +11,17 @@
 let Cu = Components.utils;
 let Ci = Components.interfaces;
 let Cc = Components.classes;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
 Cu.import("resource://gre/modules/DownloadUtils.jsm");
 Cu.import("resource:///modules/DownloadsCommon.jsm");
+Cu.import("resource://gre/modules/PlacesUtils.jsm");
 
 const nsIDM = Ci.nsIDownloadManager;
 
 const DESTINATION_FILE_URI_ANNO  = "downloads/destinationFileURI";
 const DESTINATION_FILE_NAME_ANNO = "downloads/destinationFileName";
 const DOWNLOAD_STATE_ANNO        = "downloads/state";
 
 const DOWNLOAD_VIEW_SUPPORTED_COMMANDS =
--- a/browser/components/downloads/content/allDownloadsViewOverlay.xul
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.xul
@@ -16,23 +16,24 @@
      using the DownloadsView API, and history downloads, using places queries.
      The view also implements a command controller and a context menu for
      managing the downloads list.  In order to use this view:
      1. Apply this overlay to your window.
      2. Insert in all the overlay entry-points, namely:
         <richlistbox id="downloadsRichListBox"/>
         <commandset id="downloadCommands"/>
         <menupopup id="downloadsContextMenu"/>
-    3. Make sure your window also has the editMenuOverlay overlay applied,
+    3. Make sure your window has the editMenuOverlay overlay applied,
        because the view implements cmd_copy and cmd_delete.
-    4. To initialize the view
+    4. Make sure your window has the globalOverlay.js script loaded.
+    5. To initialize the view
         let view = new DownloadsPlacesView(document.getElementById("downloadsRichListBox"));
         // This is what the Places Library uses. It could be tweaked a bit as long as the
         // transition-type is set correctly
-        view.places = "place:transition=7&sort=4";
+        view.place = "place:transition=7&sort=4";
 -->
 <overlay id="downloadsViewOverlay"
          xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="application/javascript"
           src="chrome://browser/content/downloads/allDownloadsViewOverlay.js"/>
   <script type="application/javascript"
new file mode 100644
--- /dev/null
+++ b/browser/components/downloads/content/contentAreaDownloadsView.js
@@ -0,0 +1,10 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+let ContentAreaDownloadsView = {
+  init: function CADV_init() {
+    let view = new DownloadsPlacesView(document.getElementById("downloadsRichListBox"));
+    view.place = "place:transition=7&sort=4";
+  }
+};
new file mode 100644
--- /dev/null
+++ b/browser/components/downloads/content/contentAreaDownloadsView.xul
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+<?xml-stylesheet href="chrome://global/skin/"?>
+<?xul-overlay href="chrome://browser/content/downloads/allDownloadsViewOverlay.xul"?>
+
+<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
+
+<window id="contentAreaDownloadsView"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        onload="ContentAreaDownloadsView.init();">
+
+  <script type="application/javascript"
+          src="chrome://global/content/globalOverlay.js"/>
+  <script type="application/javascript"
+          src="chrome://browser/content/downloads/contentAreaDownloadsView.js"/>
+
+  <commandset id="editMenuCommands"/>
+
+  <keyset id="editMenuKeys">
+#ifdef XP_MACOSX
+    <key id="key_delete2" keycode="VK_BACK" command="cmd_delete"/>
+#endif
+  </keyset>
+
+  <richlistbox id="downloadsRichListBox"/>
+  <commandset id="downloadCommands"/>
+  <menupopup id="downloadsContextMenu"/>
+</window>
--- a/browser/components/downloads/jar.mn
+++ b/browser/components/downloads/jar.mn
@@ -8,8 +8,10 @@ browser.jar:
         content/browser/downloads/downloads.css          (content/downloads.css)
 *       content/browser/downloads/downloads.js           (content/downloads.js)
 *       content/browser/downloads/downloadsOverlay.xul   (content/downloadsOverlay.xul)
         content/browser/downloads/indicator.js           (content/indicator.js)
         content/browser/downloads/indicatorOverlay.xul   (content/indicatorOverlay.xul)
 *       content/browser/downloads/allDownloadsViewOverlay.xul (content/allDownloadsViewOverlay.xul)
         content/browser/downloads/allDownloadsViewOverlay.js  (content/allDownloadsViewOverlay.js)
         content/browser/downloads/allDownloadsViewOverlay.css (content/allDownloadsViewOverlay.css)
+*       content/browser/downloads/contentAreaDownloadsView.xul (content/contentAreaDownloadsView.xul)
+        content/browser/downloads/contentAreaDownloadsView.js  (content/contentAreaDownloadsView.js)