bug 935640 part 2 Australis, update social sidebar with new ux, activation panel, r=markh
authorShane Caraveo <scaraveo@mozilla.com>
Mon, 16 Dec 2013 21:38:22 -0800
changeset 160761 45d47db0c321cbc1d916c524531ec97c9ff8c1a7
parent 160760 d3ef31b50bf953a2567c2b278c695283d2fe85d9
child 160762 e53121069b64ee0d98e1c85e18dce27e8eda0dc8
push id4002
push usermixedpuppy@gmail.com
push dateTue, 17 Dec 2013 05:39:19 +0000
treeherderfx-team@e53121069b64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs935640
milestone29.0a1
bug 935640 part 2 Australis, update social sidebar with new ux, activation panel, r=markh
browser/base/content/browser-social.js
browser/base/content/browser.xul
toolkit/components/social/SocialService.jsm
--- a/browser/base/content/browser-social.js
+++ b/browser/base/content/browser-social.js
@@ -258,78 +258,25 @@ SocialUI = {
       try {
         data = JSON.parse(data);
       } catch(e) {
         Cu.reportError("Social Service manifest parse error: "+e);
         return;
       }
     }
     Social.installProvider(targetDoc, data, function(manifest) {
-      this.doActivation(manifest.origin);
-    }.bind(this));
-  },
-
-  doActivation: function SocialUI_doActivation(origin) {
-    // Keep track of the old provider in case of undo
-    let oldOrigin = Social.provider ? Social.provider.origin : "";
-
-    // Enable the social functionality, and indicate that it was activated
-    Social.activateFromOrigin(origin, function(provider) {
-      // Provider to activate may not have been found
-      if (!provider)
-        return;
-
-      // Show a warning, allow undoing the activation
-      let description = document.getElementById("social-activation-message");
-      let labels = description.getElementsByTagName("label");
-      let uri = Services.io.newURI(provider.origin, null, null)
-      labels[0].setAttribute("value", uri.host);
-      labels[1].setAttribute("onclick", "BrowserOpenAddonsMgr('addons://list/service'); SocialUI.activationPanel.hidePopup();")
-
-      let icon = document.getElementById("social-activation-icon");
-      if (provider.icon64URL || provider.icon32URL) {
-        icon.setAttribute('src', provider.icon64URL || provider.icon32URL);
-        icon.hidden = false;
-      } else {
-        icon.removeAttribute('src');
-        icon.hidden = true;
-      }
-
-      let notificationPanel = SocialUI.activationPanel;
-      // Set the origin being activated and the previously active one, to allow undo
-      notificationPanel.setAttribute("origin", provider.origin);
-      notificationPanel.setAttribute("oldorigin", oldOrigin);
-
-      // Show the panel
-      notificationPanel.hidden = false;
-      // XXX addressed in patch part 2
-      //setTimeout(function () {
-      //  notificationPanel.openPopup(SocialToolbar.button, "bottomcenter topright");
-      //}, 0);
+      Social.activateFromOrigin(manifest.origin);
     });
   },
 
-  undoActivation: function SocialUI_undoActivation() {
-    let origin = this.activationPanel.getAttribute("origin");
-    let oldOrigin = this.activationPanel.getAttribute("oldorigin");
-    Social.deactivateFromOrigin(origin, oldOrigin);
-    this.activationPanel.hidePopup();
-    Social.uninstallProvider(origin);
-  },
-
   showLearnMore: function() {
-    this.activationPanel.hidePopup();
     let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "social-api";
     openUILinkIn(url, "tab");
   },
 
-  get activationPanel() {
-    return document.getElementById("socialActivatedNotification");
-  },
-
   closeSocialPanelForLinkTraversal: function (target, linkNode) {
     // No need to close the panel if this traversal was not retargeted
     if (target == "" || target == "_self")
       return;
 
     // Check to see whether this link traversal was in a social panel
     let win = linkNode.ownerDocument.defaultView;
     let container = win.QueryInterface(Ci.nsIInterfaceRequestor)
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -208,43 +208,16 @@
     <panel id="UITourHighlightContainer"
            hidden="true"
            noautofocus="true"
            noautohide="true"
            consumeoutsideclicks="false">
       <box id="UITourHighlight"></box>
     </panel>
 
-    <panel id="socialActivatedNotification"
-           type="arrow"
-           hidden="true"
-           align="start"
-           orient="horizontal"
-           role="alert">
-      <image id="social-activation-icon" class="popup-notification-icon"/>
-      <vbox flex="1">
-        <description id="social-activation-message" class="popup-notification-description">&social.activated.description;</description>
-        <spacer flex="1"/>
-        <hbox pack="start" align="center" class="popup-notification-button-container">
-          <label  id="social-undoactivation-button"
-                  class="text-link"
-                  value="&social.activated.undo.label;"
-                  accesskey="&social.activated.undo.accesskey;"
-                  onclick="SocialUI.undoActivation(this);"/>
-          <spacer flex="1"/>
-          <button id="social-activation-button"
-                  default="true"
-                  autofocus="autofocus"
-                  label="&social.ok.label;"
-                  accesskey="&social.ok.accesskey;"
-                  oncommand="SocialUI.activationPanel.hidePopup();"/>
-        </hbox>
-      </vbox>
-    </panel>
-
     <panel id="social-share-panel"
            class="social-panel"
            type="arrow"
            orient="horizontal"
            onpopupshowing="SocialShare.onShowing()"
            onpopuphidden="SocialShare.onHidden()"
            hidden="true">
       <vbox class="social-share-toolbar">
--- a/toolkit/components/social/SocialService.jsm
+++ b/toolkit/components/social/SocialService.jsm
@@ -649,17 +649,17 @@ this.SocialService = {
         }
       case "directory":
         // a manifest is requried, and will have been vetted by reviewers
       case "whitelist":
         // a manifest is required, we'll catch a missing manifest below.
         if (!manifest)
           throw new Error("Cannot install provider without manifest data");
         installer = new AddonInstaller(sourceURI, manifest, installCallback);
-        installer.install();
+        this._showInstallNotification(aDOMDocument, installer);
         break;
       default:
         throw new Error("SocialService.installProvider: Invalid install type "+installType+"\n");
         break;
     }
   },
 
   /**