Add the add-on name and icon in in a very not wonderful fashion draft
authorMark Striemer <mstriemer@mozilla.com>
Thu, 09 Nov 2017 17:18:36 -0600
changeset 695865 3527e326e2ec7995cdefc9f7fd6ac1cab317de59
parent 695824 89f84422a3fbf8f5a948f9bfe8e292d0b641ee4d
child 739729 195841dd0bd3583dad4c174bbe75f76ba5b0233e
push id88572
push userbmo:mstriemer@mozilla.com
push dateThu, 09 Nov 2017 23:18:59 +0000
milestone58.0a1
Add the add-on name and icon in in a very not wonderful fashion MozReview-Commit-ID: 53ojMfuTbmZ
browser/components/customizableui/content/panelUI.inc.xul
browser/components/extensions/ext-url-overrides.js
browser/locales/en-US/chrome/browser/browser.dtd
browser/themes/shared/customizableui/panelUI.inc.css
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -779,15 +779,16 @@
                      label="&newTabControlled.header.message;"
                      buttonlabel="&newTabControlled.keepButton.label;"
                      buttonaccesskey="&newTabControlled.keepButton.accesskey;"
                      secondarybuttonlabel="&newTabControlled.restoreButton.label;"
                      secondarybuttonaccesskey="&newTabControlled.restoreButton.accesskey;"
                      closebuttonhidden="true"
                      dropmarkerhidden="true"
                      checkboxhidden="true">
-    <popupnotificationcontent id="extension-new-tab-notification-content" orient="vertical">
-      <description class="notification-panel-content">
+    <popupnotificationcontent orient="vertical">
+      <description id="extension-new-tab-notification-description"/>
+      <description id="extension-new-tab-notification-description-text" hidden="true">
         &newTabControlled.message;
       </description>
     </popupnotificationcontent>
   </popupnotification>
 </panel>
--- a/browser/components/extensions/ext-url-overrides.js
+++ b/browser/components/extensions/ext-url-overrides.js
@@ -56,20 +56,40 @@ async function handleNewTabNotificationC
 
 async function handleNewTabOpened() {
   let item = ExtensionSettingsStore.getSetting(STORE_TYPE, NEW_TAB_SETTING_NAME);
 
   if (!item || !item.id || userWasNotified(item.id)) {
     return;
   }
 
+  let addon = await AddonManager.getAddonByID(item.id);
+
   // Find the elements we need.
   let win = windowTracker.getCurrentWindow({});
   let doc = win.document;
   let panel = doc.getElementById("extension-notification-panel");
+  let description = doc.getElementById("extension-new-tab-notification-description");
+  let descriptionTextParts = doc
+    .getElementById("extension-new-tab-notification-description-text")
+    .textContent
+    .split("EXTENSION_NAME");
+
+  while (description.firstChild) {
+    description.firstChild.remove();
+  }
+
+  description.appendChild(doc.createTextNode(descriptionTextParts[0]));
+  let image = doc.createElement("image");
+  const defaultIcon = "chrome://mozapps/skin/extensions/extensionGeneric.svg";
+  image.setAttribute("src", addon.iconURL || defaultIcon);
+  image.classList.add("extension-controlled-icon");
+  description.appendChild(image);
+  description.appendChild(doc.createTextNode(` ${addon.name}`));
+  description.appendChild(doc.createTextNode(descriptionTextParts[1]));
 
   // Setup the command handler.
   let handleCommand = async (event) => {
     await handleNewTabNotificationCommand(
       event.originalTarget.getAttribute("anonid") == "button" ? "keep" : "restore",
       item.id);
     panel.hidePopup();
   };
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -960,17 +960,17 @@ you can use these alternative items. Oth
 <!ENTITY updateRestart.message2 "After a quick restart, &brandShorterName; will restore all your open tabs and windows that are not in Private Browsing mode.">
 <!ENTITY updateRestart.header.message2 "Restart to update &brandShorterName;.">
 <!ENTITY updateRestart.acceptButton.label "Restart and Restore">
 <!ENTITY updateRestart.acceptButton.accesskey "R">
 <!ENTITY updateRestart.cancelButton.label "Not Now">
 <!ENTITY updateRestart.cancelButton.accesskey "N">
 <!ENTITY updateRestart.panelUI.label2 "Restart to update &brandShorterName;">
 
-<!ENTITY newTabControlled.message "An extension has changed the page you see when you open a New Tab. You can restore your settings if you do not want this change.">
+<!ENTITY newTabControlled.message "An extension, EXTENSION_NAME, has changed the page you see when you open a New Tab. You can restore your settings if you do not want this change.">
 <!ENTITY newTabControlled.header.message "Your New Tab has changed.">
 <!ENTITY newTabControlled.keepButton.label "Keep Changes">
 <!ENTITY newTabControlled.keepButton.accesskey "K">
 <!ENTITY newTabControlled.restoreButton.label "Restore Settings">
 <!ENTITY newTabControlled.restoreButton.accesskey "R">
 
 <!ENTITY pageActionButton.tooltip "Page actions">
 <!ENTITY pageAction.addToUrlbar.label "Add to Address Bar">
--- a/browser/themes/shared/customizableui/panelUI.inc.css
+++ b/browser/themes/shared/customizableui/panelUI.inc.css
@@ -461,20 +461,26 @@ panelview:not([mainview]) .toolbarbutton
   width: 30em;
 }
 
 #extension-new-tab-notification > .popup-notification-body-container > .popup-notification-body > hbox > vbox > .popup-notification-description {
   font-size: 1.3em;
   font-weight: lighter;
 }
 
-#extension-new-tab-notification > .popup-notification-body-container > .popup-notification-body > .notification-panel-content {
+#extension-new-tab-notification-description {
   margin-bottom: 0;
 }
 
+#extension-new-tab-notification-description > .extension-controlled-icon {
+  height: 15px;
+  width: 15px;
+  vertical-align: bottom;
+}
+
 #extension-new-tab-notification > .popup-notification-body-container > .popup-notification-body > .popup-notification-warning,
 #extension-new-tab-notification > .popup-notification-body-container > .popup-notification-icon {
   display: none;
 }
 /* END notification popups for extension controlled content */
 
 /* START photonpanelview adjustments */