bug 935640 part 2 Australis, update social sidebar with new ux, activation panel, r=markh

This commit is contained in:
Shane Caraveo 2013-12-16 21:38:22 -08:00
parent 8ba380e694
commit 21bd271387
3 changed files with 2 additions and 82 deletions

View File

@ -263,68 +263,15 @@ SocialUI = {
}
}
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")

View File

@ -213,33 +213,6 @@
<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"

View File

@ -654,7 +654,7 @@ this.SocialService = {
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");