Bug 1443901 - Remove downloadsViewOverlay.xul. r=paolo draft
authorBrendan Dahl <brendan.dahl@gmail.com>
Wed, 07 Mar 2018 11:59:51 -0800
changeset 768770 f16ca90aa1409500449f53aed691883daf610937
parent 768769 d1250e3ead1aa2c1b33d8ed98b37c057c427fc00
push id102974
push userbmo:bdahl@mozilla.com
push dateFri, 16 Mar 2018 20:05:04 +0000
reviewerspaolo
bugs1443901
milestone61.0a1
Bug 1443901 - Remove downloadsViewOverlay.xul. r=paolo This overlay was only used in places.xul and can be inlined there. MozReview-Commit-ID: AYvmu99lqh5
browser/components/places/content/downloadsViewOverlay.xul
browser/components/places/content/places.js
browser/components/places/content/places.xul
browser/components/places/jar.mn
deleted file mode 100644
--- a/browser/components/places/content/downloadsViewOverlay.xul
+++ /dev/null
@@ -1,47 +0,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/. -->
-
-<?xul-overlay href="chrome://browser/content/downloads/allDownloadsViewOverlay.xul"?>
-
-<!DOCTYPE overlay [
-<!ENTITY % downloadsDTD SYSTEM "chrome://browser/locale/downloads/downloads.dtd">
-%downloadsDTD;
-]>
-
-<overlay id="downloadsViewOverlay"
-         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-  <script type="application/javascript"><![CDATA[
-    const DOWNLOADS_QUERY = "place:transition=" +
-      Ci.nsINavHistoryService.TRANSITION_DOWNLOAD +
-      "&sort=" +
-      Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING;
-
-    ContentArea.setContentViewForQueryString(DOWNLOADS_QUERY,
-      () => new DownloadsPlacesView(document.getElementById("downloadsRichListBox"), false),
-      { showDetailsPane: false,
-        toolbarSet: "back-button, forward-button, organizeButton, clearDownloadsButton, libraryToolbarSpacer, searchFilter" });
-  ]]></script>
-
-  <window id="places">
-    <commandset id="downloadCommands"/>
-    <menupopup id="downloadsContextMenu"/>
-  </window>
-
-  <deck id="placesViewsDeck">
-    <richlistbox id="downloadsRichListBox"/>
-  </deck>
-
-  <toolbar id="placesToolbar">
-    <toolbarbutton id="clearDownloadsButton"
-#ifdef XP_MACOSX
-                   class="tabbable"
-#endif
-                   insertbefore="libraryToolbarSpacer"
-                   label="&clearDownloadsButton.label;"
-                   command="downloadsCmd_clearDownloads"
-                   tooltiptext="&clearDownloadsButton.tooltip;"/>
-  </toolbar>
-
-</overlay>
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -1,18 +1,19 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* 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/. */
 
 /* import-globals-from editBookmark.js */
-// Via downloadsViewOverlay.xul -> allDownloadsViewOverlay.xul
+// Via allDownloadsViewOverlay.xul
 /* import-globals-from ../../../../toolkit/content/contentAreaUtils.js */
 /* import-globals-from ../PlacesUIUtils.jsm */
 /* import-globals-from ../../../../toolkit/components/places/PlacesUtils.jsm */
+/* import-globals-from ../../downloads/content/allDownloadsViewOverlay.js */
 
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/TelemetryStopwatch.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.defineModuleGetter(this, "MigrationUtils",
                                "resource:///modules/MigrationUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "BookmarkJSONUtils",
@@ -129,16 +130,27 @@ var PlacesOrganizer = {
       }
     } finally {
       if (!selectWasSuppressed)
         this._places.view.selection.selectEventsSuppressed = false;
     }
   },
 
   init: function PO_init() {
+    // Register the downloads view.
+    const DOWNLOADS_QUERY = "place:transition=" +
+      Ci.nsINavHistoryService.TRANSITION_DOWNLOAD +
+      "&sort=" +
+      Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING;
+
+    ContentArea.setContentViewForQueryString(DOWNLOADS_QUERY,
+      () => new DownloadsPlacesView(document.getElementById("downloadsRichListBox"), false),
+      { showDetailsPane: false,
+        toolbarSet: "back-button, forward-button, organizeButton, clearDownloadsButton, libraryToolbarSpacer, searchFilter" });
+
     ContentArea.init();
 
     this._places = document.getElementById("placesList");
     this._initFolderTree();
 
     var leftPaneSelection = "AllBookmarks"; // default to all-bookmarks
     if (window.arguments && window.arguments[0])
       leftPaneSelection = window.arguments[0];
--- a/browser/components/places/content/places.xul
+++ b/browser/components/places/content/places.xul
@@ -10,20 +10,23 @@
 <?xml-stylesheet href="chrome://global/skin/"?>
 <?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
 <?xml-stylesheet href="chrome://browser/skin/places/organizer.css"?>
 <?xml-stylesheet href="chrome://browser/skin/places/editBookmark.css"?>
 
 #ifdef XP_MACOSX
 <?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
 #endif
+<?xul-overlay href="chrome://browser/content/downloads/allDownloadsViewOverlay.xul"?>
 
 <!DOCTYPE window [
 <!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
 %placesDTD;
+<!ENTITY % downloadsDTD SYSTEM "chrome://browser/locale/downloads/downloads.dtd">
+%downloadsDTD;
 <!ENTITY % editMenuOverlayDTD SYSTEM "chrome://global/locale/editMenuOverlay.dtd">
 %editMenuOverlayDTD;
 <!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
 %browserDTD;
 <!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
 %editBookmarkOverlayDTD;
 #ifdef XP_MACOSX
 <!ENTITY % baseMenuOverlayDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd">
@@ -99,17 +102,17 @@
              oncommand="PlacesOrganizer.saveSearch();"/>
     <command id="OrganizerCommand_search:moreCriteria"
              oncommand="PlacesQueryBuilder.addRow();"/>
     <command id="OrganizerCommand:Back"
              oncommand="PlacesOrganizer.back();"/>
     <command id="OrganizerCommand:Forward"
              oncommand="PlacesOrganizer.forward();"/>
   </commandset>
-
+  <commandset id="downloadCommands"/>
 
   <keyset id="placesOrganizerKeyset">
     <!-- Instantiation Keys -->
     <key id="placesKey_close" key="&cmd.close.key;" modifiers="accel"
          oncommand="close();"/>
 
     <!-- Command Keys -->
     <key id="placesKey_find:all"
@@ -156,16 +159,17 @@
   </keyset>
 #endif
 
   <popupset id="placesPopupset">
 #include placesContextMenu.inc.xul
     <menupopup id="placesColumnsContext"
                onpopupshowing="ViewMenu.fillWithColumns(event, null, null, 'checkbox', null);"
                oncommand="ViewMenu.showHideColumn(event.target); event.stopPropagation();"/>
+    <menupopup id="downloadsContextMenu"/>
   </popupset>
 
   <toolbox id="placesToolbox">
     <toolbar class="chromeclass-toolbar" id="placesToolbar" align="center">
       <toolbarbutton id="back-button"
                      command="OrganizerCommand:Back"
                      tooltiptext="&backButton.tooltip;"
                      disabled="true"/>
@@ -345,16 +349,24 @@
       <spacer id="libraryToolbarSpacer" flex="1"/>
 
       <textbox id="searchFilter"
                type="search"
                aria-controls="placeContent"
                oncommand="PlacesSearchBox.search(this.value);"
                collection="bookmarks">
       </textbox>
+      <toolbarbutton id="clearDownloadsButton"
+#ifdef XP_MACOSX
+                     class="tabbable"
+#endif
+                     insertbefore="libraryToolbarSpacer"
+                     label="&clearDownloadsButton.label;"
+                     command="downloadsCmd_clearDownloads"
+                     tooltiptext="&clearDownloadsButton.tooltip;"/>
     </toolbar>
   </toolbox>
 
   <hbox flex="1" id="placesView">
     <tree id="placesList"
           class="plain placesTree"
           type="places"
           hidecolumnpicker="true" context="placesContext"
@@ -411,16 +423,17 @@
             <treecol label="&col.dateadded.label;" id="placesContentDateAdded" anonid="dateAdded" flex="1" hidden="true"
                       persist="width hidden ordinal sortActive sortDirection"/>
             <splitter class="tree-splitter"/>
             <treecol label="&col.lastmodified.label;" id="placesContentLastModified" anonid="lastModified" flex="1" hidden="true"
                       persist="width hidden ordinal sortActive sortDirection"/>
           </treecols>
           <treechildren flex="1" onclick="ContentTree.onClick(event);"/>
         </tree>
+        <richlistbox id="downloadsRichListBox"/>
       </deck>
       <deck id="detailsDeck" style="height: 11em;">
         <vbox id="itemsCountBox" align="center">
           <spacer flex="3"/>
           <label id="itemsCountText"/>
           <spacer flex="1"/>
           <description id="selectItemDescription">
               &detailsPane.selectAnItemText.description;
--- a/browser/components/places/jar.mn
+++ b/browser/components/places/jar.mn
@@ -1,14 +1,13 @@
 # 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/.
 
 browser.jar:
-% overlay chrome://browser/content/places/places.xul chrome://browser/content/places/downloadsViewOverlay.xul
 # Provide another URI for the bookmarkProperties dialog so we can persist the
 # attributes separately
 *   content/browser/places/bookmarkProperties2.xul       (content/bookmarkProperties.xul)
 *   content/browser/places/places.xul                    (content/places.xul)
     content/browser/places/places.js                     (content/places.js)
     content/browser/places/places.css                    (content/places.css)
     content/browser/places/organizer.css                 (content/organizer.css)
 *   content/browser/places/bookmarkProperties.xul        (content/bookmarkProperties.xul)
@@ -22,9 +21,8 @@ browser.jar:
 # to prevent having to worry about between versions of the browser
 *   content/browser/history/history-panel.xul            (content/history-panel.xul)
     content/browser/places/history-panel.js              (content/history-panel.js)
 # ditto for the bookmarks sidebar
 *   content/browser/bookmarks/bookmarksPanel.xul         (content/bookmarksPanel.xul)
     content/browser/bookmarks/bookmarksPanel.js          (content/bookmarksPanel.js)
     content/browser/bookmarks/sidebarUtils.js            (content/sidebarUtils.js)
     content/browser/places/editBookmark.js               (content/editBookmark.js)
-*   content/browser/places/downloadsViewOverlay.xul      (content/downloadsViewOverlay.xul)