Bug 1279224 - remove all Sync promotions from doorhangers (beta version). r=adw, a=gchang
authorMark Hammond <mhammond@skippinet.com.au>
Mon, 04 Jul 2016 16:29:00 +0200
changeset 333563 274a291aa2c85528ffeb988f0b1b0b61c12136b8
parent 333562 6ed47505536deec0da00473df5d068a5ea3e6353
child 333564 6ad50d4d6f7b3c96801a3ecd1afe5464705a0d87
push id6170
push usercbook@mozilla.com
push dateTue, 05 Jul 2016 15:08:46 +0000
treeherdermozilla-beta@274a291aa2c8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, gchang
bugs1279224
milestone48.0
Bug 1279224 - remove all Sync promotions from doorhangers (beta version). r=adw, a=gchang MozReview-Commit-ID: 8QELFxqM6Av
browser/base/content/browser.css
browser/base/content/browser.xul
browser/base/content/popup-notifications.inc
browser/base/content/urlbarBindings.xml
browser/components/nsBrowserGlue.js
browser/themes/linux/browser.css
browser/themes/osx/browser.css
browser/themes/windows/browser-aero.css
browser/themes/windows/browser.css
toolkit/content/widgets/popup.xml
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -836,20 +836,16 @@ statuspanel[inactive][previoustype=overL
 }
 
 .statuspanel-inner {
   height: 3em;
   width: 100%;
   -moz-box-align: end;
 }
 
-.panel-inner-arrowcontentfooter[footertype="promobox"] {
-  -moz-binding: url("chrome://browser/content/urlbarBindings.xml#promobox");
-}
-
 /* gcli */
 
 html|*#gcli-tooltip-frame,
 html|*#gcli-output-frame,
 #gcli-output,
 #gcli-tooltip {
   overflow-x: hidden;
 }
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -169,17 +169,16 @@
 
     <!-- for invalid form error message -->
     <panel id="invalid-form-popup" type="arrow" orient="vertical" noautofocus="true" hidden="true" level="parent">
       <description/>
     </panel>
 
     <panel id="editBookmarkPanel"
            type="arrow"
-           footertype="promobox"
            orient="vertical"
            ignorekeys="true"
            hidden="true"
            onpopupshown="StarUI.panelShown(event);"
            aria-labelledby="editBookmarkPanelTitle">
       <row id="editBookmarkPanelHeader" align="center" hidden="true">
         <vbox align="center">
           <image id="editBookmarkPanelStarIcon"/>
--- a/browser/base/content/popup-notifications.inc
+++ b/browser/base/content/popup-notifications.inc
@@ -1,13 +1,12 @@
 # to be included inside a popupset element
 
     <panel id="notification-popup"
            type="arrow"
-           footertype="promobox"
            position="after_start"
            hidden="true"
            orient="vertical"
            noautofocus="true"
            role="alert"/>
 
     <popupnotification id="webRTC-shareDevices-notification" hidden="true">
       <popupnotificationcontent id="webRTC-selectCamera" orient="vertical">
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -2452,179 +2452,9 @@ file, You can obtain one at http://mozil
       <constructor><![CDATA[
         this.setAttribute("tooltiptext", this.getAttribute("acceltext"));
         // TODO: Simplify this to this.setAttribute("acceltext", "") once bug
         // 592424 is fixed
         document.getAnonymousElementByAttribute(this, "anonid", "accel").firstChild.setAttribute("value", "");
       ]]></constructor>
     </implementation>
   </binding>
-
- <binding id="promobox">
-    <content>
-      <xul:hbox class="panel-promo-box" align="start" flex="1">
-        <xul:hbox align="center" flex="1">
-          <xul:image class="panel-promo-icon"/>
-          <xul:description anonid="promo-message" class="panel-promo-message" flex="1">
-            <xul:description anonid="promo-link"
-                             class="plain text-link inline-link"
-                             onclick="document.getBindingParent(this).onLinkClick();"/>
-          </xul:description>
-        </xul:hbox>
-        <xul:toolbarbutton class="panel-promo-closebutton close-icon"
-                           oncommand="document.getBindingParent(this).onCloseButtonCommand();"
-                           tooltiptext="&closeNotification.tooltip;"/>
-      </xul:hbox>
-    </content>
-
-    <implementation implements="nsIDOMEventListener">
-      <constructor><![CDATA[
-        this._panel.addEventListener("popupshowing", this, false);
-      ]]></constructor>
-
-      <destructor><![CDATA[
-        this._panel.removeEventListener("popupshowing", this, false);
-      ]]></destructor>
-
-      <field name="_panel" readonly="true"><![CDATA[
-        {
-          let node = this.parentNode;
-          while(node && node.localName != "panel") {
-            node = node.parentNode;
-          }
-          node;
-        }
-      ]]></field>
-      <field name="_promomessage" readonly="true">
-        document.getAnonymousElementByAttribute(this, "anonid", "promo-message");
-      </field>
-      <field name="_promolink" readonly="true">
-        document.getAnonymousElementByAttribute(this, "anonid", "promo-link");
-      </field>
-      <field name="_brandBundle" readonly="true">
-        Services.strings.createBundle("chrome://branding/locale/brand.properties");
-      </field>
-      <property name="_viewsLeftMap">
-        <getter><![CDATA[
-          try {
-            return JSON.parse(Services.prefs.getCharPref("browser.syncPromoViewsLeftMap"));
-          } catch (ex) {}
-          return {};
-        ]]></getter>
-      </property>
-      <property name="_viewsLeft">
-        <getter><![CDATA[
-          let views = 5;
-          let map = this._viewsLeftMap;
-          if (this._notificationType in map) {
-            views = map[this._notificationType];
-          }
-          return views;
-        ]]></getter>
-        <setter><![CDATA[
-          let map = this._viewsLeftMap;
-          map[this._notificationType] = val;
-          Services.prefs.setCharPref("browser.syncPromoViewsLeftMap",
-                                     JSON.stringify(map));
-          return val;
-        ]]></setter>
-      </property>
-      <property name="_notificationType">
-        <getter><![CDATA[
-          // Use the popupid attribute to identify the notification type,
-          // otherwise just rely on the panel id for common arrowpanels.
-          let type = this._panel.firstChild.getAttribute("popupid") ||
-                     this._panel.id;
-          if (type == "editBookmarkPanel")
-            return "bookmarks";
-          if (type == "addon-install-complete" || type == "addon-install-restart") {
-            if (!Services.prefs.prefHasUserValue("services.sync.username"))
-              return "addons";
-            if (!Services.prefs.getBoolPref("services.sync.engine.addons"))
-              return "addons-sync-disabled";
-          }
-          return null;
-        ]]></getter>
-      </property>
-      <property name="_notificationMessage">
-        <getter><![CDATA[
-          return gNavigatorBundle.getFormattedString(
-            "syncPromoNotification." + this._notificationType + ".description",
-            [this._brandBundle.GetStringFromName("syncBrandShortName")]
-          );
-        ]]></getter>
-      </property>
-      <property name="_notificationLink">
-        <getter><![CDATA[
-          if (this._notificationType == "addons-sync-disabled") {
-            return "https://support.mozilla.org/kb/how-do-i-enable-add-sync";
-          }
-          return "https://services.mozilla.com/sync/";
-        ]]></getter>
-      </property>
-      <method name="onCloseButtonCommand">
-        <body><![CDATA[
-          this._viewsLeft = 0;
-          this.hidden = true;
-        ]]></body>
-      </method>
-      <method name="onLinkClick">
-        <body><![CDATA[
-          // Open a new selected tab and close the current panel.
-          openUILinkIn(this._promolink.getAttribute("href"), "tab");
-          this._panel.hidePopup();
-        ]]></body>
-      </method>
-      <method name="handleEvent">
-        <parameter name="event"/>
-        <body><![CDATA[
-          if (event.type != "popupshowing" || event.target != this._panel)
-            return;
-
-          // A previous notification may have unhidden this.
-          this.hidden = true;
-
-          // Only handle supported notification panels.
-          if (!this._notificationType) {
-            return;
-          }
-
-          let viewsLeft = this._viewsLeft;
-          if (viewsLeft) {
-            if (Services.prefs.prefHasUserValue("services.sync.username") &&
-               this._notificationType != "addons-sync-disabled") {
-              // If the user has already setup Sync, don't show the notification.
-              this._viewsLeft = 0;
-              // Be sure to hide the panel, in case it was visible and the user
-              // decided to setup Sync after noticing it.
-              viewsLeft = 0;
-              // The panel is still hidden, just bail out.
-              return;
-            }
-            else {
-              this._viewsLeft = viewsLeft - 1;
-            }
-
-            this._promolink.setAttribute("href", this._notificationLink);
-            this._promolink.value = gNavigatorBundle.getString("syncPromoNotification.learnMoreLinkText");
-
-            this.hidden = false;
-
-            // HACK: The description element doesn't wrap correctly in panels,
-            // thus set a width on it, based on the available space, before
-            // setting its textContent.  Then set its height as well, to
-            // fix wrong height calculation on Linux (bug 659578).
-            this._panel.addEventListener("popupshown", function panelShown() {
-              this._panel.removeEventListener("popupshown", panelShown, true);
-              // Previous popupShown events may close the panel or change
-              // its contents, so ensure this is still valid.
-              if (this._panel.state != "open" || !this._notificationType)
-                return;
-              this._promomessage.width = this._promomessage.getBoundingClientRect().width;
-              this._promomessage.firstChild.textContent = this._notificationMessage;
-              this._promomessage.height = this._promomessage.getBoundingClientRect().height;
-            }.bind(this), true);
-          }
-        ]]></body>
-      </method>
-    </implementation>
-  </binding>
 </bindings>
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1991,22 +1991,16 @@ BrowserGlue.prototype = {
       }
     }
 
     if (currentUIVersion < 20) {
       // Remove persisted collapsed state from TabsToolbar.
       xulStore.removeValue(BROWSER_DOCURL, "TabsToolbar", "collapsed");
     }
 
-    if (currentUIVersion < 22) {
-      // Reset the Sync promobox count to promote the new FxAccount-based Sync.
-      Services.prefs.clearUserPref("browser.syncPromoViewsLeft");
-      Services.prefs.clearUserPref("browser.syncPromoViewsLeftMap");
-    }
-
     if (currentUIVersion < 23) {
       const kSelectedEnginePref = "browser.search.selectedEngine";
       if (Services.prefs.prefHasUserValue(kSelectedEnginePref)) {
         try {
           let name = Services.prefs.getComplexValue(kSelectedEnginePref,
                                                     Ci.nsIPrefLocalizedString).data;
           Services.search.currentEngine = Services.search.getEngineByName(name);
         } catch (ex) {}
--- a/browser/themes/linux/browser.css
+++ b/browser/themes/linux/browser.css
@@ -1463,39 +1463,16 @@ html|span.ac-emphasize-text-url {
   margin-bottom: .5em;
 }
 
 /* Implements editBookmarkPanel resizing on folderTree un-collapse. */
 #editBMPanel_folderTree {
   min-width: 27em;
 }
 
-.panel-promo-box {
-  margin: 8px -10px -10px -10px;
-  padding: 8px 10px;
-  border-top: 1px solid ThreeDShadow;
-  background-image: linear-gradient(hsla(0,0%,0%,.15), hsla(0,0%,0%,.08) 6px);
-}
-
-.panel-promo-icon {
-  list-style-image: url("chrome://browser/skin/sync-notification-24.png");
-  -moz-margin-end: 10px;
-  vertical-align: middle;
-}
-
-.panel-promo-closebutton {
-  -moz-appearance: none;
-  height: 16px;
-  width: 16px;
-}
-
-.panel-promo-closebutton > .toolbarbutton-text {
-  padding: 0;
-}
-
 /* Content area */
 #sidebar {
   background-color: Window;
 }
 
 #sidebar-header > .close-icon:not(:hover):-moz-lwtheme-brighttext {
   background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 80, 16, 64);
 }
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -2329,48 +2329,16 @@ html|span.ac-emphasize-text-url {
   opacity: 1.0;
   color: #bbb;
 }
 
 .editBMPanel_rowLabel {
   text-align: end;
 }
 
-.panel-promo-box {
-  margin: 8px -16px -16px -16px;
-  padding: 8px 16px;
-  background-color: hsla(210,4%,10%,.07);
-  border-top: 1px solid hsla(210,4%,10%,.12);
-  border-radius: 0 0 5px 5px;
-  box-shadow: 0 -1px hsla(0,0%,100%,.5) inset, 0 1px 1px hsla(0,0%,0%,.03) inset;
-  color: hsl(0,0%,30%);
-}
-
-.panel-promo-icon {
-  list-style-image: url("chrome://browser/skin/sync-notification-24.png");
-  -moz-margin-end: 10px;
-  vertical-align: middle;
-}
-
-.panel-promo-closebutton {
-  border: none;
-  -moz-margin-end: -14px;
-  margin-top: -8px;
-}
-
-.panel-promo-closebutton > .toolbarbutton-text {
-  padding: 0;
-}
-
-@media (min-resolution: 2dppx) {
-  .panel-promo-closebutton > .toolbarbutton-icon {
-    width: 16px;
-  }
-}
-
 /* History Swipe Animation */
 
 #historySwipeAnimationCurrentPage,
 #historySwipeAnimationNextPage {
   box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
 }
 
 #historySwipeAnimationContainer {
--- a/browser/themes/windows/browser-aero.css
+++ b/browser/themes/windows/browser-aero.css
@@ -4,20 +4,16 @@
 
 %define glassActiveBorderColor rgb(37, 44, 51)
 %define glassInactiveBorderColor rgb(102, 102, 102)
 
 @media not all and (-moz-windows-classic) {
   #main-window[sizemode="normal"] > #tab-view-deck > #browser-panel > #navigator-toolbox > #toolbar-menubar {
     margin-top: 1px;
   }
-
-  .panel-promo-message {
-    font-style: italic;
-  }
 }
 
 @media (-moz-windows-default-theme) {
   .sidebar-header,
   #sidebar-header {
     -moz-appearance: none;
     border-bottom: none;
     text-shadow: none;
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -1848,51 +1848,16 @@ html|span.ac-emphasize-text-url {
   margin-bottom: .5em;
 }
 
 /* Implements editBookmarkPanel resizing on folderTree un-collapse. */
 #editBMPanel_folderTree {
   min-width: 27em;
 }
 
-.panel-promo-box {
-  margin: 10px -10px -10px;
-  padding: 8px 10px;
-  border-top: 1px solid ThreeDShadow;
-  background-image: linear-gradient(hsla(0,0%,0%,.15), hsla(0,0%,0%,.08) 6px);
-  border-bottom-left-radius: 3px;
-  border-bottom-right-radius: 3px;
-}
-
-@media (-moz-windows-default-theme) {
-  .panel-promo-box {
-    border-top-style: none;
-    background: #f1f5fb;
-    color: GrayText;
-    box-shadow: 0px 1px 2px rgb(204,214,234) inset;
-  }
-}
-
-.panel-promo-icon {
-  list-style-image: url("chrome://browser/skin/sync-notification-24.png");
-  -moz-margin-end: 10px;
-  vertical-align: middle;
-}
-
-.panel-promo-closebutton {
-  -moz-appearance: none;
-  border: none;
-  -moz-margin-end: -10px;
-  margin-top: -5px;
-}
-
-.panel-promo-closebutton > .toolbarbutton-text {
-  padding: 0;
-}
-
 /* ::::: content area ::::: */
 
 #sidebar {
   background-color: Window;
 }
 
 #sidebar-title {
   -moz-padding-start: 0px;
--- a/toolkit/content/widgets/popup.xml
+++ b/toolkit/content/widgets/popup.xml
@@ -341,17 +341,16 @@
     <content flip="both" side="top" position="bottomcenter topleft" consumeoutsideclicks="false">
       <xul:vbox anonid="container" class="panel-arrowcontainer" flex="1"
                xbl:inherits="side,panelopen">
         <xul:box anonid="arrowbox" class="panel-arrowbox">
           <xul:image anonid="arrow" class="panel-arrow" xbl:inherits="side"/>
         </xul:box>
         <xul:box class="panel-arrowcontent" xbl:inherits="side,align,dir,orient,pack" flex="1">
           <children/>
-          <xul:box class="panel-inner-arrowcontentfooter" xbl:inherits="footertype" hidden="true"/>
         </xul:box>
       </xul:vbox>
     </content>
     <implementation>
       <field name="_fadeTimer">null</field>
       <method name="sizeTo">
         <parameter name="aWidth"/>
         <parameter name="aHeight"/>