Bug 716643 - Sync promotion in add-on installed doorhanger, r=mak
authorTheo Chevalier <theo.chevalier11@gmail.com>
Tue, 24 Jul 2012 18:21:24 +0200
changeset 100302 efeaf7b68f58d194dfabf2eb056fd147caacc1de
parent 100301 98a7b0f3b53984829f3e0dc9e54cbd61f7238b1d
child 100303 08a1e103ec0d524a975eceee54dfef74ab8cbc04
push id23175
push useremorley@mozilla.com
push dateWed, 25 Jul 2012 15:03:49 +0000
treeherdermozilla-central@75d16b99e8ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs716643
milestone17.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 716643 - Sync promotion in add-on installed doorhanger, r=mak
browser/base/content/urlbarBindings.xml
browser/locales/en-US/chrome/browser/browser.properties
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1370,27 +1370,41 @@
           // 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 (/^password-/.test(type))
             return "passwords";
           if (type == "editBookmarkPanel")
             return "bookmarks";
+          if (type == "addon-install-complete") {
+            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[
@@ -1411,30 +1425,31 @@
 
           // Only handle supported notification panels.
           if (!this._notificationType) {
             return;
           }
 
           let viewsLeft = this._viewsLeft;
           if (viewsLeft) {
-            if (Services.prefs.prefHasUserValue("services.sync.username")) {
+            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", "https://services.mozilla.com/sync/");
+            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).
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -335,16 +335,27 @@ browser.menu.showCharacterEncoding=false
 # the add bookmark star panel.  %S will be replaced by syncBrandShortName.
 # The final space separates this text from the Learn More link.
 syncPromoNotification.bookmarks.description=You can access your bookmarks on all your devices with %S.\u0020
 # LOCALIZATION NOTE (syncPromoNotification.passwords.label): This appears in
 # the remember password panel.  %S will be replaced by syncBrandShortName.
 # The final space separates this text from the Learn More link.
 syncPromoNotification.passwords.description=You can access your passwords on all your devices with %S.\u0020
 syncPromoNotification.learnMoreLinkText=Learn More
+# LOCALIZATION NOTE (syncPromoNotification.addons.label): This appears in
+# the add-on install complete panel when Sync isn't set.
+# %S will be replaced by syncBrandShortName.
+# The final space separates this text from the Learn More link.
+syncPromoNotification.addons.description=You can access your add-ons on all your devices with %S.\u0020
+# LOCALIZATION NOTE (syncPromoNotification.addons-sync-disabled.label):
+# This appears in the add-on install complete panel when Sync is set
+# but addons sync is not. %S will be replaced by syncBrandShortName.
+# The final space separates this text from the Learn More link.
+syncPromoNotification.addons-sync-disabled.description=You can use your %S account to synchronize add-ons across multiple computers.\u0020
+ 
 
 # Telemetry prompt
 # LOCALIZATION NOTE (telemetryOptInPrompt): %1$S will be replaced by
 # brandFullName, and %2$S by the value of the toolkit.telemetry.server_owner
 # preference.
 telemetryOptInPrompt = Will you help improve %1$S by sending information about performance, hardware, usage, and customizations to %2$S?
 telemetryLinkLabel = Learn More
 telemetryYesButtonLabel2 = Yes, I want to help