2012-07-12 01:31:19 +00:00
|
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2012-10-05 03:32:38 +00:00
|
|
|
// The minimum sizes for the auto-resize panel code.
|
2012-10-08 06:14:55 +00:00
|
|
|
const PANEL_MIN_HEIGHT = 100;
|
2012-10-05 03:32:38 +00:00
|
|
|
const PANEL_MIN_WIDTH = 330;
|
|
|
|
|
2012-07-12 01:31:19 +00:00
|
|
|
let SocialUI = {
|
|
|
|
// Called on delayed startup to initialize UI
|
|
|
|
init: function SocialUI_init() {
|
|
|
|
Services.obs.addObserver(this, "social:pref-changed", false);
|
2012-07-15 23:12:13 +00:00
|
|
|
Services.obs.addObserver(this, "social:ambient-notification-changed", false);
|
|
|
|
Services.obs.addObserver(this, "social:profile-changed", false);
|
|
|
|
|
2012-07-18 18:40:05 +00:00
|
|
|
Services.prefs.addObserver("social.sidebar.open", this, false);
|
2012-09-27 00:40:18 +00:00
|
|
|
Services.prefs.addObserver("social.toast-notifications.enabled", this, false);
|
2012-07-18 18:40:05 +00:00
|
|
|
|
2012-06-22 22:01:34 +00:00
|
|
|
gBrowser.addEventListener("ActivateSocialFeature", this._activationEventHandler, true, true);
|
|
|
|
|
2012-10-03 23:11:52 +00:00
|
|
|
// Called when we enter DOM full-screen mode.
|
|
|
|
window.addEventListener("mozfullscreenchange", function () SocialSidebar.updateSidebar());
|
|
|
|
|
2012-07-12 01:31:19 +00:00
|
|
|
Social.init(this._providerReady.bind(this));
|
|
|
|
},
|
|
|
|
|
|
|
|
// Called on window unload
|
|
|
|
uninit: function SocialUI_uninit() {
|
|
|
|
Services.obs.removeObserver(this, "social:pref-changed");
|
2012-07-15 23:12:13 +00:00
|
|
|
Services.obs.removeObserver(this, "social:ambient-notification-changed");
|
|
|
|
Services.obs.removeObserver(this, "social:profile-changed");
|
2012-07-18 18:40:05 +00:00
|
|
|
|
|
|
|
Services.prefs.removeObserver("social.sidebar.open", this);
|
2012-09-27 00:40:18 +00:00
|
|
|
Services.prefs.removeObserver("social.toast-notifications.enabled", this);
|
2012-07-12 01:31:19 +00:00
|
|
|
},
|
|
|
|
|
2012-07-15 23:12:13 +00:00
|
|
|
showProfile: function SocialUI_showProfile() {
|
2012-09-28 23:37:58 +00:00
|
|
|
if (this.haveLoggedInUser())
|
2012-08-31 19:57:42 +00:00
|
|
|
openUILinkIn(Social.provider.profile.profileURL, "tab");
|
2012-09-28 23:37:58 +00:00
|
|
|
else {
|
|
|
|
// XXX Bug 789585 will implement an API for provider-specified login pages.
|
|
|
|
openUILinkIn(Social.provider.origin, "tab");
|
|
|
|
}
|
2012-07-15 23:12:13 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
observe: function SocialUI_observe(subject, topic, data) {
|
|
|
|
switch (topic) {
|
|
|
|
case "social:pref-changed":
|
2012-08-20 21:18:50 +00:00
|
|
|
// Exceptions here sometimes don't get reported properly, report them
|
|
|
|
// manually :(
|
|
|
|
try {
|
|
|
|
this.updateToggleCommand();
|
|
|
|
SocialShareButton.updateButtonHiddenState();
|
|
|
|
SocialToolbar.updateButtonHiddenState();
|
|
|
|
SocialSidebar.updateSidebar();
|
2012-08-21 00:52:26 +00:00
|
|
|
SocialChatBar.update();
|
2012-08-24 00:11:02 +00:00
|
|
|
SocialFlyout.unload();
|
2012-08-20 21:18:50 +00:00
|
|
|
} catch (e) {
|
|
|
|
Components.utils.reportError(e);
|
|
|
|
throw e;
|
|
|
|
}
|
2012-07-15 23:12:13 +00:00
|
|
|
break;
|
|
|
|
case "social:ambient-notification-changed":
|
|
|
|
SocialToolbar.updateButton();
|
2012-10-22 00:25:19 +00:00
|
|
|
SocialMenu.populate();
|
2012-07-15 23:12:13 +00:00
|
|
|
break;
|
|
|
|
case "social:profile-changed":
|
|
|
|
SocialToolbar.updateProfile();
|
2012-07-25 17:35:57 +00:00
|
|
|
SocialShareButton.updateProfileInfo();
|
2012-09-23 23:49:28 +00:00
|
|
|
SocialChatBar.update();
|
2012-07-15 23:12:13 +00:00
|
|
|
break;
|
2012-07-18 18:40:05 +00:00
|
|
|
case "nsPref:changed":
|
|
|
|
SocialSidebar.updateSidebar();
|
2012-09-27 00:40:18 +00:00
|
|
|
SocialToolbar.updateButton();
|
2012-10-22 00:25:19 +00:00
|
|
|
SocialMenu.populate();
|
|
|
|
break;
|
2012-07-15 23:12:13 +00:00
|
|
|
}
|
2012-07-12 01:31:19 +00:00
|
|
|
},
|
|
|
|
|
2012-07-23 03:49:28 +00:00
|
|
|
get toggleCommand() {
|
|
|
|
return document.getElementById("Social:Toggle");
|
|
|
|
},
|
|
|
|
|
2012-07-12 01:31:19 +00:00
|
|
|
// Called once Social.jsm's provider has been set
|
|
|
|
_providerReady: function SocialUI_providerReady() {
|
2012-06-22 22:01:34 +00:00
|
|
|
// If we couldn't find a provider, nothing to do here.
|
|
|
|
if (!Social.provider)
|
|
|
|
return;
|
|
|
|
|
2012-07-23 03:49:28 +00:00
|
|
|
this.updateToggleCommand();
|
|
|
|
|
|
|
|
let toggleCommand = this.toggleCommand;
|
2012-08-24 21:46:11 +00:00
|
|
|
let brandShortName = document.getElementById("bundle_brand").getString("brandShortName");
|
|
|
|
let label = gNavigatorBundle.getFormattedString("social.toggle.label",
|
|
|
|
[Social.provider.name,
|
|
|
|
brandShortName]);
|
|
|
|
let accesskey = gNavigatorBundle.getString("social.toggle.accesskey");
|
2012-07-23 03:49:28 +00:00
|
|
|
toggleCommand.setAttribute("label", label);
|
|
|
|
toggleCommand.setAttribute("accesskey", accesskey);
|
|
|
|
|
2012-10-25 19:30:59 +00:00
|
|
|
let kbMenuitem = document.getElementById("menu_socialAmbientMenu");
|
|
|
|
kbMenuitem.hidden = !Social.enabled;
|
|
|
|
kbMenuitem.setAttribute("label", label);
|
|
|
|
kbMenuitem.setAttribute("accesskey", accesskey);
|
|
|
|
|
2012-10-30 06:28:31 +00:00
|
|
|
// The View->Sidebar menu.
|
|
|
|
document.getElementById("menu_socialSidebar").setAttribute("label", Social.provider.name);
|
|
|
|
|
2012-07-15 23:12:13 +00:00
|
|
|
SocialToolbar.init();
|
2012-07-12 01:31:19 +00:00
|
|
|
SocialShareButton.init();
|
2012-07-18 18:40:05 +00:00
|
|
|
SocialSidebar.init();
|
2012-10-22 00:25:19 +00:00
|
|
|
SocialMenu.populate();
|
2012-06-22 22:01:34 +00:00
|
|
|
},
|
|
|
|
|
2012-07-23 03:49:28 +00:00
|
|
|
updateToggleCommand: function SocialUI_updateToggleCommand() {
|
|
|
|
let toggleCommand = this.toggleCommand;
|
2012-10-23 07:47:33 +00:00
|
|
|
// We only need to update the command itself - all our menu items use it.
|
2012-09-24 21:57:12 +00:00
|
|
|
toggleCommand.setAttribute("checked", Services.prefs.getBoolPref("social.enabled"));
|
2012-10-23 07:47:33 +00:00
|
|
|
toggleCommand.setAttribute("hidden", Social.active ? "false" : "true");
|
2012-07-23 03:49:28 +00:00
|
|
|
},
|
|
|
|
|
2012-06-22 22:01:34 +00:00
|
|
|
// This handles "ActivateSocialFeature" events fired against content documents
|
|
|
|
// in this window.
|
|
|
|
_activationEventHandler: function SocialUI_activationHandler(e) {
|
2012-10-25 19:29:12 +00:00
|
|
|
// Nothing to do if Social is already enabled, or we don't have a provider
|
2012-06-22 22:01:34 +00:00
|
|
|
// to enable yet.
|
2012-10-25 19:29:12 +00:00
|
|
|
if (Social.enabled || !Social.provider)
|
2012-06-22 22:01:34 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
let targetDoc = e.target;
|
|
|
|
|
|
|
|
// Event must be fired against the document
|
|
|
|
if (!(targetDoc instanceof HTMLDocument))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Ignore events fired in background tabs
|
|
|
|
if (targetDoc.defaultView.top != content)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Check that the associated document's origin is in our whitelist
|
|
|
|
let prePath = targetDoc.documentURIObject.prePath;
|
2012-08-07 01:00:59 +00:00
|
|
|
let whitelist = Services.prefs.getCharPref("social.activation.whitelist");
|
2012-06-22 22:01:34 +00:00
|
|
|
if (whitelist.split(",").indexOf(prePath) == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// If the last event was received < 1s ago, ignore this one
|
|
|
|
let now = Date.now();
|
|
|
|
if (now - Social.lastEventReceived < 1000)
|
|
|
|
return;
|
|
|
|
Social.lastEventReceived = now;
|
|
|
|
|
|
|
|
// Enable the social functionality, and indicate that it was activated
|
|
|
|
Social.active = true;
|
|
|
|
|
|
|
|
// Show a warning, allow undoing the activation
|
|
|
|
let description = document.getElementById("social-activation-message");
|
|
|
|
let brandShortName = document.getElementById("bundle_brand").getString("brandShortName");
|
2012-08-24 21:46:11 +00:00
|
|
|
let message = gNavigatorBundle.getFormattedString("social.activated.description",
|
2012-06-22 22:01:34 +00:00
|
|
|
[Social.provider.name, brandShortName]);
|
|
|
|
description.value = message;
|
|
|
|
|
|
|
|
SocialUI.notificationPanel.hidden = false;
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
SocialUI.notificationPanel.openPopup(SocialToolbar.button, "bottomcenter topright");
|
|
|
|
}.bind(this), 0);
|
|
|
|
},
|
|
|
|
|
|
|
|
get notificationPanel() {
|
|
|
|
return document.getElementById("socialActivatedNotification")
|
|
|
|
},
|
|
|
|
|
|
|
|
undoActivation: function SocialUI_undoActivation() {
|
|
|
|
Social.active = false;
|
|
|
|
this.notificationPanel.hidePopup();
|
2012-09-23 23:49:28 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
haveLoggedInUser: function SocialUI_haveLoggedInUser() {
|
|
|
|
return !!(Social.provider && Social.provider.profile && Social.provider.profile.userName);
|
2012-10-16 06:58:13 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
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)
|
|
|
|
.getInterface(Ci.nsIWebNavigation)
|
|
|
|
.QueryInterface(Ci.nsIDocShell)
|
|
|
|
.chromeEventHandler;
|
|
|
|
let containerParent = container.parentNode;
|
|
|
|
if (containerParent.classList.contains("social-panel") &&
|
|
|
|
containerParent instanceof Ci.nsIDOMXULPopupElement) {
|
|
|
|
containerParent.hidePopup();
|
|
|
|
}
|
2012-10-30 06:25:53 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
disableWithConfirmation: function SocialUI_disableWithConfirmation() {
|
|
|
|
let brandShortName = document.getElementById("bundle_brand").getString("brandShortName");
|
|
|
|
let dialogTitle = gNavigatorBundle.getFormattedString("social.remove.confirmationOK",
|
|
|
|
[Social.provider.name]);
|
|
|
|
let text = gNavigatorBundle.getFormattedString("social.remove.confirmationLabel",
|
|
|
|
[Social.provider.name, brandShortName]);
|
|
|
|
let okButtonText = dialogTitle;
|
|
|
|
|
|
|
|
let ps = Services.prompt;
|
|
|
|
let flags = ps.BUTTON_TITLE_IS_STRING * ps.BUTTON_POS_0 +
|
|
|
|
ps.BUTTON_TITLE_CANCEL * ps.BUTTON_POS_1 +
|
|
|
|
ps.BUTTON_POS_0_DEFAULT;
|
|
|
|
|
|
|
|
let confirmationIndex = ps.confirmEx(null, dialogTitle, text, flags,
|
|
|
|
okButtonText, null, null, null, {});
|
|
|
|
if (confirmationIndex == 0)
|
|
|
|
Social.active = false;
|
2012-07-12 01:31:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-21 00:52:26 +00:00
|
|
|
let SocialChatBar = {
|
|
|
|
get chatbar() {
|
|
|
|
return document.getElementById("pinnedchats");
|
|
|
|
},
|
|
|
|
// Whether the chats can be shown for this window.
|
|
|
|
get canShow() {
|
2012-09-23 23:49:28 +00:00
|
|
|
if (!SocialUI.haveLoggedInUser())
|
|
|
|
return false;
|
2012-08-21 00:52:26 +00:00
|
|
|
let docElem = document.documentElement;
|
|
|
|
let chromeless = docElem.getAttribute("disablechrome") ||
|
|
|
|
docElem.getAttribute("chromehidden").indexOf("extrachrome") >= 0;
|
2012-10-03 23:11:52 +00:00
|
|
|
return Social.uiVisible && !chromeless && !document.mozFullScreen;
|
2012-08-21 00:52:26 +00:00
|
|
|
},
|
2012-08-26 23:51:24 +00:00
|
|
|
openChat: function(aProvider, aURL, aCallback, aMode) {
|
2012-08-21 00:52:26 +00:00
|
|
|
if (this.canShow)
|
2012-08-26 23:51:24 +00:00
|
|
|
this.chatbar.openChat(aProvider, aURL, aCallback, aMode);
|
2012-08-21 00:52:26 +00:00
|
|
|
},
|
|
|
|
update: function() {
|
|
|
|
if (!this.canShow)
|
|
|
|
this.chatbar.removeAll();
|
2012-10-24 06:45:59 +00:00
|
|
|
},
|
|
|
|
focus: function SocialChatBar_focus() {
|
|
|
|
let commandDispatcher = gBrowser.ownerDocument.commandDispatcher;
|
|
|
|
commandDispatcher.advanceFocusIntoSubtree(this.chatbar);
|
2012-08-21 00:52:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-08 06:14:55 +00:00
|
|
|
function sizeSocialPanelToContent(panel, iframe) {
|
2012-08-24 00:11:02 +00:00
|
|
|
// FIXME: bug 764787: Maybe we can use nsIDOMWindowUtils.getRootBounds() here?
|
|
|
|
let doc = iframe.contentDocument;
|
2012-10-05 03:32:38 +00:00
|
|
|
if (!doc || !doc.body) {
|
2012-08-24 00:11:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-10-05 03:32:38 +00:00
|
|
|
let body = doc.body;
|
|
|
|
// offsetHeight/Width don't include margins, so account for that.
|
2012-09-26 06:22:38 +00:00
|
|
|
let cs = doc.defaultView.getComputedStyle(body);
|
|
|
|
let computedHeight = parseInt(cs.marginTop) + body.offsetHeight + parseInt(cs.marginBottom);
|
2012-10-05 03:32:38 +00:00
|
|
|
let height = Math.max(computedHeight, PANEL_MIN_HEIGHT);
|
|
|
|
let computedWidth = parseInt(cs.marginLeft) + body.offsetWidth + parseInt(cs.marginRight);
|
|
|
|
let width = Math.max(computedWidth, PANEL_MIN_WIDTH);
|
2012-10-08 06:14:55 +00:00
|
|
|
let wDiff = width - iframe.getBoundingClientRect().width;
|
|
|
|
// A panel resize will move the right margin - if that is where the anchor
|
|
|
|
// arrow is, the arrow will be mis-aligned from the anchor. So we move the
|
|
|
|
// popup to compensate for that. See bug 799014.
|
|
|
|
if (wDiff !== 0 && panel.getAttribute("side") == "right") {
|
|
|
|
let box = panel.boxObject;
|
|
|
|
panel.moveTo(box.screenX - wDiff, box.screenY);
|
|
|
|
}
|
|
|
|
iframe.style.height = height + "px";
|
2012-10-05 03:32:38 +00:00
|
|
|
iframe.style.width = width + "px";
|
2012-08-24 00:11:02 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 03:32:38 +00:00
|
|
|
function DynamicResizeWatcher() {
|
|
|
|
this._mutationObserver = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
DynamicResizeWatcher.prototype = {
|
2012-10-08 06:14:55 +00:00
|
|
|
start: function DynamicResizeWatcher_start(panel, iframe) {
|
2012-10-05 03:32:38 +00:00
|
|
|
this.stop(); // just in case...
|
|
|
|
let doc = iframe.contentDocument;
|
|
|
|
this._mutationObserver = new iframe.contentWindow.MutationObserver(function(mutations) {
|
2012-10-08 06:14:55 +00:00
|
|
|
sizeSocialPanelToContent(panel, iframe);
|
2012-10-05 03:32:38 +00:00
|
|
|
});
|
|
|
|
// Observe anything that causes the size to change.
|
|
|
|
let config = {attributes: true, characterData: true, childList: true, subtree: true};
|
|
|
|
this._mutationObserver.observe(doc, config);
|
|
|
|
// and since this may be setup after the load event has fired we do an
|
|
|
|
// initial resize now.
|
2012-10-08 06:14:55 +00:00
|
|
|
sizeSocialPanelToContent(panel, iframe);
|
2012-10-05 03:32:38 +00:00
|
|
|
},
|
|
|
|
stop: function DynamicResizeWatcher_stop() {
|
|
|
|
if (this._mutationObserver) {
|
|
|
|
try {
|
|
|
|
this._mutationObserver.disconnect();
|
|
|
|
} catch (ex) {
|
|
|
|
// may get "TypeError: can't access dead object" which seems strange,
|
|
|
|
// but doesn't seem to indicate a real problem, so ignore it...
|
|
|
|
}
|
|
|
|
this._mutationObserver = null;
|
2012-09-26 06:22:38 +00:00
|
|
|
}
|
2012-10-05 03:32:38 +00:00
|
|
|
}
|
2012-09-26 06:22:38 +00:00
|
|
|
}
|
|
|
|
|
2012-08-24 00:11:02 +00:00
|
|
|
let SocialFlyout = {
|
|
|
|
get panel() {
|
|
|
|
return document.getElementById("social-flyout-panel");
|
|
|
|
},
|
|
|
|
|
|
|
|
dispatchPanelEvent: function(name) {
|
|
|
|
let doc = this.panel.firstChild.contentDocument;
|
|
|
|
let evt = doc.createEvent("CustomEvent");
|
|
|
|
evt.initCustomEvent(name, true, true, {});
|
|
|
|
doc.documentElement.dispatchEvent(evt);
|
|
|
|
},
|
|
|
|
|
|
|
|
_createFrame: function() {
|
|
|
|
let panel = this.panel;
|
|
|
|
if (!Social.provider || panel.firstChild)
|
|
|
|
return;
|
|
|
|
// create and initialize the panel for this window
|
|
|
|
let iframe = document.createElement("iframe");
|
|
|
|
iframe.setAttribute("type", "content");
|
2012-09-06 23:13:37 +00:00
|
|
|
iframe.setAttribute("class", "social-panel-frame");
|
2012-08-24 00:11:02 +00:00
|
|
|
iframe.setAttribute("flex", "1");
|
|
|
|
iframe.setAttribute("origin", Social.provider.origin);
|
|
|
|
panel.appendChild(iframe);
|
|
|
|
},
|
|
|
|
|
2012-10-06 00:22:09 +00:00
|
|
|
setUpProgressListener: function SF_setUpProgressListener() {
|
|
|
|
if (!this._progressListenerSet) {
|
|
|
|
this._progressListenerSet = true;
|
|
|
|
// Force a layout flush by calling .clientTop so
|
|
|
|
// that the docShell of this frame is created
|
|
|
|
this.panel.firstChild.clientTop;
|
|
|
|
this.panel.firstChild.docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Ci.nsIWebProgress)
|
|
|
|
.addProgressListener(new SocialErrorListener("flyout"),
|
|
|
|
Ci.nsIWebProgress.NOTIFY_STATE_REQUEST |
|
|
|
|
Ci.nsIWebProgress.NOTIFY_LOCATION);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setFlyoutErrorMessage: function SF_setFlyoutErrorMessage() {
|
|
|
|
let iframe = this.panel.firstChild;
|
|
|
|
if (!iframe)
|
|
|
|
return;
|
|
|
|
|
|
|
|
iframe.removeAttribute("src");
|
|
|
|
iframe.webNavigation.loadURI("about:socialerror?mode=compactInfo", null, null, null, null);
|
|
|
|
sizeSocialPanelToContent(iframe);
|
|
|
|
},
|
|
|
|
|
2012-08-24 00:11:02 +00:00
|
|
|
unload: function() {
|
|
|
|
let panel = this.panel;
|
2012-09-26 06:23:25 +00:00
|
|
|
panel.hidePopup();
|
2012-08-24 00:11:02 +00:00
|
|
|
if (!panel.firstChild)
|
|
|
|
return
|
|
|
|
panel.removeChild(panel.firstChild);
|
|
|
|
},
|
|
|
|
|
|
|
|
onShown: function(aEvent) {
|
2012-10-08 06:14:55 +00:00
|
|
|
let panel = this.panel;
|
|
|
|
let iframe = panel.firstChild;
|
2012-10-05 03:32:38 +00:00
|
|
|
this._dynamicResizer = new DynamicResizeWatcher();
|
2012-08-24 00:11:02 +00:00
|
|
|
iframe.docShell.isActive = true;
|
|
|
|
iframe.docShell.isAppTab = true;
|
|
|
|
if (iframe.contentDocument.readyState == "complete") {
|
2012-10-08 06:14:55 +00:00
|
|
|
this._dynamicResizer.start(panel, iframe);
|
2012-08-24 00:11:02 +00:00
|
|
|
this.dispatchPanelEvent("socialFrameShow");
|
|
|
|
} else {
|
|
|
|
// first time load, wait for load and dispatch after load
|
|
|
|
iframe.addEventListener("load", function panelBrowserOnload(e) {
|
|
|
|
iframe.removeEventListener("load", panelBrowserOnload, true);
|
|
|
|
setTimeout(function() {
|
2012-10-08 06:14:55 +00:00
|
|
|
SocialFlyout._dynamicResizer.start(panel, iframe);
|
2012-08-24 00:11:02 +00:00
|
|
|
SocialFlyout.dispatchPanelEvent("socialFrameShow");
|
|
|
|
}, 0);
|
|
|
|
}, true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onHidden: function(aEvent) {
|
2012-10-05 03:32:38 +00:00
|
|
|
this._dynamicResizer.stop();
|
|
|
|
this._dynamicResizer = null;
|
2012-08-24 00:11:02 +00:00
|
|
|
this.panel.firstChild.docShell.isActive = false;
|
|
|
|
this.dispatchPanelEvent("socialFrameHide");
|
|
|
|
},
|
|
|
|
|
|
|
|
open: function(aURL, yOffset, aCallback) {
|
2012-10-22 00:28:37 +00:00
|
|
|
// Hide any other social panels that may be open.
|
|
|
|
document.getElementById("social-notification-panel").hidePopup();
|
|
|
|
|
2012-08-24 00:11:02 +00:00
|
|
|
if (!Social.provider)
|
|
|
|
return;
|
|
|
|
let panel = this.panel;
|
|
|
|
if (!panel.firstChild)
|
|
|
|
this._createFrame();
|
|
|
|
panel.hidden = false;
|
|
|
|
let iframe = panel.firstChild;
|
|
|
|
|
|
|
|
let src = iframe.getAttribute("src");
|
|
|
|
if (src != aURL) {
|
|
|
|
iframe.addEventListener("load", function documentLoaded() {
|
|
|
|
iframe.removeEventListener("load", documentLoaded, true);
|
|
|
|
if (aCallback) {
|
|
|
|
try {
|
|
|
|
aCallback(iframe.contentWindow);
|
|
|
|
} catch(e) {
|
|
|
|
Cu.reportError(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, true);
|
|
|
|
iframe.setAttribute("src", aURL);
|
|
|
|
}
|
|
|
|
else if (aCallback) {
|
|
|
|
try {
|
|
|
|
aCallback(iframe.contentWindow);
|
|
|
|
} catch(e) {
|
|
|
|
Cu.reportError(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-08 06:14:55 +00:00
|
|
|
sizeSocialPanelToContent(panel, iframe);
|
2012-08-24 00:11:02 +00:00
|
|
|
let anchor = document.getElementById("social-sidebar-browser");
|
2012-09-21 05:18:48 +00:00
|
|
|
if (panel.state == "open") {
|
|
|
|
// this is painful - there is no way to say "move to a new anchor offset",
|
|
|
|
// only "move to new screen pos". So we remember the last yOffset,
|
|
|
|
// calculate the adjustment needed to the new yOffset, then calc the
|
|
|
|
// screen Y position.
|
|
|
|
let yAdjust = yOffset - this.yOffset;
|
|
|
|
let box = panel.boxObject;
|
|
|
|
panel.moveTo(box.screenX, box.screenY + yAdjust);
|
|
|
|
} else {
|
|
|
|
panel.openPopup(anchor, "start_before", 0, yOffset, false, false);
|
2012-10-06 00:22:09 +00:00
|
|
|
this.setUpProgressListener();
|
2012-09-21 05:18:48 +00:00
|
|
|
}
|
|
|
|
this.yOffset = yOffset;
|
2012-08-24 00:11:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-12 01:31:19 +00:00
|
|
|
let SocialShareButton = {
|
2012-08-27 11:16:38 +00:00
|
|
|
// promptImages and promptMessages being null means we are yet to get the
|
|
|
|
// message back from the provider with the images and icons (or that we got
|
|
|
|
// the response but determined it was invalid.)
|
|
|
|
promptImages: null,
|
|
|
|
promptMessages: null,
|
|
|
|
|
2012-07-18 18:40:05 +00:00
|
|
|
// Called once, after window load, when the Social.provider object is initialized
|
2012-07-12 01:31:19 +00:00
|
|
|
init: function SSB_init() {
|
2012-07-15 23:12:13 +00:00
|
|
|
this.updateButtonHiddenState();
|
2012-07-25 17:35:57 +00:00
|
|
|
this.updateProfileInfo();
|
|
|
|
},
|
2012-07-17 17:47:04 +00:00
|
|
|
|
2012-07-25 17:35:57 +00:00
|
|
|
updateProfileInfo: function SSB_updateProfileInfo() {
|
2012-09-25 03:54:34 +00:00
|
|
|
let profileRow = document.getElementById("unsharePopupHeader");
|
2012-07-17 17:47:04 +00:00
|
|
|
let profile = Social.provider.profile;
|
2012-09-06 20:47:01 +00:00
|
|
|
this.promptImages = null;
|
|
|
|
this.promptMessages = null;
|
2012-08-02 22:30:19 +00:00
|
|
|
if (profile && profile.displayName) {
|
2012-07-17 17:47:04 +00:00
|
|
|
profileRow.hidden = false;
|
|
|
|
let portrait = document.getElementById("socialUserPortrait");
|
2012-09-25 18:39:09 +00:00
|
|
|
portrait.setAttribute("src", profile.portrait || "chrome://global/skin/icons/information-32.png");
|
2012-07-17 17:47:04 +00:00
|
|
|
let displayName = document.getElementById("socialUserDisplayName");
|
|
|
|
displayName.setAttribute("label", profile.displayName);
|
|
|
|
} else {
|
|
|
|
profileRow.hidden = true;
|
2012-09-06 20:47:01 +00:00
|
|
|
this.updateButtonHiddenState();
|
|
|
|
return;
|
2012-07-17 17:47:04 +00:00
|
|
|
}
|
2012-08-27 11:16:38 +00:00
|
|
|
// XXX - this shouldn't be done as part of updateProfileInfo, but instead
|
|
|
|
// whenever we notice the provider has changed - but the concept of
|
|
|
|
// "provider changed" will only exist once bug 774520 lands.
|
|
|
|
// get the recommend-prompt info.
|
2012-09-12 02:48:38 +00:00
|
|
|
let port = Social.provider.getWorkerPort();
|
2012-08-27 11:16:38 +00:00
|
|
|
if (port) {
|
|
|
|
port.onmessage = function(evt) {
|
|
|
|
if (evt.data.topic == "social.user-recommend-prompt-response") {
|
|
|
|
port.close();
|
|
|
|
this.acceptRecommendInfo(evt.data.data);
|
|
|
|
this.updateButtonHiddenState();
|
|
|
|
this.updateShareState();
|
|
|
|
}
|
|
|
|
}.bind(this);
|
|
|
|
port.postMessage({topic: "social.user-recommend-prompt"});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
acceptRecommendInfo: function SSB_acceptRecommendInfo(data) {
|
|
|
|
// Accept *and validate* the user-recommend-prompt-response message.
|
|
|
|
let promptImages = {};
|
|
|
|
let promptMessages = {};
|
|
|
|
function reportError(reason) {
|
|
|
|
Cu.reportError("Invalid recommend data from provider: " + reason + ": sharing is disabled for this provider");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!data ||
|
|
|
|
!data.images || typeof data.images != "object" ||
|
|
|
|
!data.messages || typeof data.messages != "object") {
|
|
|
|
return reportError("data is missing valid 'images' or 'messages' elements");
|
|
|
|
}
|
|
|
|
for (let sub of ["share", "unshare"]) {
|
|
|
|
let url = data.images[sub];
|
|
|
|
if (!url || typeof url != "string" || url.length == 0) {
|
|
|
|
return reportError('images["' + sub + '"] is missing or not a non-empty string');
|
|
|
|
}
|
|
|
|
// resolve potentially relative URLs then check the scheme is acceptable.
|
|
|
|
url = Services.io.newURI(Social.provider.origin, null, null).resolve(url);
|
|
|
|
let uri = Services.io.newURI(url, null, null);
|
|
|
|
if (!uri.schemeIs("http") && !uri.schemeIs("https") && !uri.schemeIs("data")) {
|
|
|
|
return reportError('images["' + sub + '"] does not have a valid scheme');
|
|
|
|
}
|
|
|
|
promptImages[sub] = url;
|
|
|
|
}
|
2012-09-25 03:54:34 +00:00
|
|
|
for (let sub of ["shareTooltip", "unshareTooltip",
|
|
|
|
"sharedLabel", "unsharedLabel", "unshareLabel",
|
|
|
|
"portraitLabel",
|
|
|
|
"unshareConfirmLabel", "unshareConfirmAccessKey",
|
|
|
|
"unshareCancelLabel", "unshareCancelAccessKey"]) {
|
2012-08-27 11:16:38 +00:00
|
|
|
if (typeof data.messages[sub] != "string" || data.messages[sub].length == 0) {
|
|
|
|
return reportError('messages["' + sub + '"] is not a valid string');
|
|
|
|
}
|
|
|
|
promptMessages[sub] = data.messages[sub];
|
|
|
|
}
|
|
|
|
this.promptImages = promptImages;
|
|
|
|
this.promptMessages = promptMessages;
|
|
|
|
return true;
|
2012-07-12 01:31:19 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
get shareButton() {
|
|
|
|
return document.getElementById("share-button");
|
|
|
|
},
|
2012-09-25 03:54:34 +00:00
|
|
|
get unsharePopup() {
|
|
|
|
return document.getElementById("unsharePopup");
|
2012-07-12 01:31:19 +00:00
|
|
|
},
|
|
|
|
|
2012-09-25 03:54:34 +00:00
|
|
|
dismissUnsharePopup: function SSB_dismissUnsharePopup() {
|
|
|
|
this.unsharePopup.hidePopup();
|
2012-07-12 01:31:19 +00:00
|
|
|
},
|
|
|
|
|
2012-10-25 05:44:53 +00:00
|
|
|
canSharePage: function SSB_canSharePage(aURI) {
|
|
|
|
// We only allow sharing of http or https
|
|
|
|
return aURI && (aURI.schemeIs('http') || aURI.schemeIs('https'));
|
|
|
|
},
|
|
|
|
|
2012-07-15 23:12:13 +00:00
|
|
|
updateButtonHiddenState: function SSB_updateButtonHiddenState() {
|
2012-07-12 01:31:19 +00:00
|
|
|
let shareButton = this.shareButton;
|
|
|
|
if (shareButton)
|
2012-09-06 20:47:01 +00:00
|
|
|
shareButton.hidden = !Social.uiVisible || this.promptImages == null ||
|
2012-10-25 05:44:53 +00:00
|
|
|
!SocialUI.haveLoggedInUser() ||
|
|
|
|
!this.canSharePage(gBrowser.currentURI);
|
2012-07-12 01:31:19 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onClick: function SSB_onClick(aEvent) {
|
|
|
|
if (aEvent.button != 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Don't bubble to the textbox, to avoid unwanted selection of the address.
|
|
|
|
aEvent.stopPropagation();
|
|
|
|
|
|
|
|
this.sharePage();
|
|
|
|
},
|
|
|
|
|
|
|
|
panelShown: function SSB_panelShown(aEvent) {
|
2012-09-25 03:54:34 +00:00
|
|
|
function updateElement(id, attrs) {
|
|
|
|
let el = document.getElementById(id);
|
|
|
|
Object.keys(attrs).forEach(function(attr) {
|
|
|
|
el.setAttribute(attr, attrs[attr]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
let continueSharingButton = document.getElementById("unsharePopupContinueSharingButton");
|
|
|
|
continueSharingButton.focus();
|
|
|
|
updateElement("unsharePopupContinueSharingButton",
|
|
|
|
{label: this.promptMessages.unshareCancelLabel,
|
|
|
|
accesskey: this.promptMessages.unshareCancelAccessKey});
|
|
|
|
updateElement("unsharePopupStopSharingButton",
|
|
|
|
{label: this.promptMessages.unshareConfirmLabel,
|
|
|
|
accesskey: this.promptMessages.unshareConfirmAccessKey});
|
|
|
|
updateElement("socialUserPortrait",
|
|
|
|
{"aria-label": this.promptMessages.portraitLabel});
|
|
|
|
updateElement("socialUserRecommendedText",
|
|
|
|
{value: this.promptMessages.unshareLabel});
|
2012-07-12 01:31:19 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
sharePage: function SSB_sharePage() {
|
2012-09-25 03:54:34 +00:00
|
|
|
this.unsharePopup.hidden = false;
|
2012-07-18 18:40:05 +00:00
|
|
|
|
2012-07-12 01:31:19 +00:00
|
|
|
let uri = gBrowser.currentURI;
|
|
|
|
if (!Social.isPageShared(uri)) {
|
|
|
|
Social.sharePage(uri);
|
|
|
|
this.updateShareState();
|
|
|
|
} else {
|
2012-09-25 03:54:34 +00:00
|
|
|
this.unsharePopup.openPopup(this.shareButton, "bottomcenter topright");
|
2012-07-12 01:31:19 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
unsharePage: function SSB_unsharePage() {
|
|
|
|
Social.unsharePage(gBrowser.currentURI);
|
|
|
|
this.updateShareState();
|
2012-09-25 03:54:34 +00:00
|
|
|
this.dismissUnsharePopup();
|
2012-07-12 01:31:19 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
updateShareState: function SSB_updateShareState() {
|
2012-10-25 05:44:53 +00:00
|
|
|
// we might have been called due to a location change, and the new location
|
|
|
|
// might change the state of "can this url be shared"
|
|
|
|
this.updateButtonHiddenState();
|
|
|
|
|
|
|
|
let shareButton = this.shareButton;
|
|
|
|
let currentPageShared = shareButton && !shareButton.hidden && Social.isPageShared(gBrowser.currentURI);
|
2012-07-12 01:31:19 +00:00
|
|
|
|
|
|
|
// Provide a11y-friendly notification of share.
|
|
|
|
let status = document.getElementById("share-button-status");
|
|
|
|
if (status) {
|
2012-08-27 11:16:38 +00:00
|
|
|
// XXX - this should also be capable of reflecting that the page was
|
|
|
|
// unshared (ie, it needs to manage three-states: (1) nothing done, (2)
|
|
|
|
// shared, (3) shared then unshared)
|
|
|
|
// Note that we *do* have an appropriate string from the provider for
|
|
|
|
// this (promptMessages['unsharedLabel'] but currently lack a way of
|
|
|
|
// tracking this state)
|
2012-07-12 01:31:19 +00:00
|
|
|
let statusString = currentPageShared ?
|
2012-08-27 11:16:38 +00:00
|
|
|
this.promptMessages['sharedLabel'] : "";
|
2012-07-12 01:31:19 +00:00
|
|
|
status.setAttribute("value", statusString);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update the share button, if present
|
2012-08-27 11:16:38 +00:00
|
|
|
if (!shareButton || shareButton.hidden)
|
2012-07-12 01:31:19 +00:00
|
|
|
return;
|
|
|
|
|
2012-08-27 11:16:38 +00:00
|
|
|
let imageURL;
|
2012-07-12 01:31:19 +00:00
|
|
|
if (currentPageShared) {
|
|
|
|
shareButton.setAttribute("shared", "true");
|
2012-08-27 11:16:38 +00:00
|
|
|
shareButton.setAttribute("tooltiptext", this.promptMessages['unshareTooltip']);
|
|
|
|
imageURL = this.promptImages["unshare"]
|
2012-07-12 01:31:19 +00:00
|
|
|
} else {
|
|
|
|
shareButton.removeAttribute("shared");
|
2012-08-27 11:16:38 +00:00
|
|
|
shareButton.setAttribute("tooltiptext", this.promptMessages['shareTooltip']);
|
|
|
|
imageURL = this.promptImages["share"]
|
2012-07-12 01:31:19 +00:00
|
|
|
}
|
2012-10-24 02:46:05 +00:00
|
|
|
shareButton.src = imageURL;
|
2012-07-12 01:31:19 +00:00
|
|
|
}
|
|
|
|
};
|
2012-07-15 23:12:13 +00:00
|
|
|
|
2012-10-12 01:21:50 +00:00
|
|
|
var SocialMenu = {
|
|
|
|
populate: function SocialMenu_populate() {
|
|
|
|
// This menu is only accessible through keyboard navigation.
|
|
|
|
let submenu = document.getElementById("menu_socialAmbientMenuPopup");
|
2012-10-22 00:25:19 +00:00
|
|
|
let ambientMenuItems = submenu.getElementsByClassName("ambient-menuitem");
|
|
|
|
for (let ambientMenuItem of ambientMenuItems)
|
|
|
|
submenu.removeChild(ambientMenuItem);
|
2012-10-25 19:30:59 +00:00
|
|
|
|
|
|
|
let separator = document.getElementById("socialAmbientMenuSeparator");
|
|
|
|
separator.hidden = true;
|
2012-10-12 01:21:50 +00:00
|
|
|
let provider = Social.provider;
|
|
|
|
if (Social.active && provider) {
|
|
|
|
let iconNames = Object.keys(provider.ambientNotificationIcons);
|
2012-10-12 01:35:42 +00:00
|
|
|
for (let name of iconNames) {
|
2012-10-12 01:21:50 +00:00
|
|
|
let icon = provider.ambientNotificationIcons[name];
|
|
|
|
if (!icon.label || !icon.menuURL)
|
|
|
|
continue;
|
2012-10-25 19:30:59 +00:00
|
|
|
separator.hidden = false;
|
2012-10-12 01:21:50 +00:00
|
|
|
let menuitem = document.createElement("menuitem");
|
|
|
|
menuitem.setAttribute("label", icon.label);
|
2012-10-22 00:25:19 +00:00
|
|
|
menuitem.classList.add("ambient-menuitem");
|
2012-10-12 01:21:50 +00:00
|
|
|
menuitem.addEventListener("command", function() {
|
|
|
|
openUILinkIn(icon.menuURL, "tab");
|
|
|
|
}, false);
|
2012-10-22 00:25:19 +00:00
|
|
|
submenu.insertBefore(menuitem, separator);
|
2012-10-12 01:21:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-15 23:12:13 +00:00
|
|
|
var SocialToolbar = {
|
|
|
|
// Called once, after window load, when the Social.provider object is initialized
|
|
|
|
init: function SocialToolbar_init() {
|
2012-10-04 04:00:57 +00:00
|
|
|
this.button.setAttribute("image", Social.provider.iconURL);
|
2012-10-30 06:25:53 +00:00
|
|
|
|
|
|
|
let removeItem = document.getElementById("social-remove-menuitem");
|
|
|
|
let brandShortName = document.getElementById("bundle_brand").getString("brandShortName");
|
|
|
|
let label = gNavigatorBundle.getFormattedString("social.remove.label",
|
|
|
|
[brandShortName]);
|
|
|
|
let accesskey = gNavigatorBundle.getString("social.remove.accesskey");
|
|
|
|
removeItem.setAttribute("label", label);
|
|
|
|
removeItem.setAttribute("accesskey", accesskey);
|
|
|
|
|
2012-07-15 23:12:13 +00:00
|
|
|
this.updateButton();
|
|
|
|
this.updateProfile();
|
2012-10-05 03:32:38 +00:00
|
|
|
this._dynamicResizer = new DynamicResizeWatcher();
|
2012-07-15 23:12:13 +00:00
|
|
|
},
|
|
|
|
|
2012-10-04 04:00:57 +00:00
|
|
|
get button() {
|
|
|
|
return document.getElementById("social-provider-button");
|
|
|
|
},
|
|
|
|
|
2012-07-15 23:12:13 +00:00
|
|
|
updateButtonHiddenState: function SocialToolbar_updateButtonHiddenState() {
|
2012-09-27 23:57:37 +00:00
|
|
|
let tbi = document.getElementById("social-toolbar-item");
|
|
|
|
tbi.hidden = !Social.uiVisible;
|
2012-09-23 23:49:28 +00:00
|
|
|
if (!SocialUI.haveLoggedInUser()) {
|
2012-10-16 06:58:13 +00:00
|
|
|
let parent = document.getElementById("social-notification-panel");
|
2012-09-27 23:57:37 +00:00
|
|
|
while (parent.hasChildNodes())
|
|
|
|
parent.removeChild(parent.firstChild);
|
|
|
|
|
|
|
|
while (tbi.lastChild != tbi.firstChild)
|
|
|
|
tbi.removeChild(tbi.lastChild);
|
2012-08-17 01:02:23 +00:00
|
|
|
}
|
2012-07-15 23:12:13 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
updateProfile: function SocialToolbar_updateProfile() {
|
|
|
|
// Profile may not have been initialized yet, since it depends on a worker
|
|
|
|
// response. In that case we'll be called again when it's available, via
|
|
|
|
// social:profile-changed
|
|
|
|
let profile = Social.provider.profile || {};
|
2012-09-25 18:39:09 +00:00
|
|
|
let userPortrait = profile.portrait || "chrome://global/skin/icons/information-32.png";
|
2012-07-15 23:12:13 +00:00
|
|
|
document.getElementById("social-statusarea-user-portrait").setAttribute("src", userPortrait);
|
|
|
|
|
|
|
|
let notLoggedInLabel = document.getElementById("social-statusarea-notloggedin");
|
|
|
|
let userNameBtn = document.getElementById("social-statusarea-username");
|
|
|
|
if (profile.userName) {
|
|
|
|
notLoggedInLabel.hidden = true;
|
|
|
|
userNameBtn.hidden = false;
|
2012-10-09 23:29:13 +00:00
|
|
|
userNameBtn.value = profile.userName;
|
2012-07-15 23:12:13 +00:00
|
|
|
} else {
|
|
|
|
notLoggedInLabel.hidden = false;
|
|
|
|
userNameBtn.hidden = true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
updateButton: function SocialToolbar_updateButton() {
|
|
|
|
this.updateButtonHiddenState();
|
|
|
|
let provider = Social.provider;
|
2012-10-08 00:15:02 +00:00
|
|
|
let icons = provider.ambientNotificationIcons;
|
|
|
|
let iconNames = Object.keys(icons);
|
2012-09-27 23:57:37 +00:00
|
|
|
let iconBox = document.getElementById("social-toolbar-item");
|
2012-08-23 18:23:17 +00:00
|
|
|
let panel = document.getElementById("social-notification-panel");
|
|
|
|
panel.hidden = false;
|
2012-10-08 00:15:02 +00:00
|
|
|
|
|
|
|
let command = document.getElementById("Social:ToggleNotifications");
|
|
|
|
command.setAttribute("checked", Services.prefs.getBoolPref("social.toast-notifications.enabled"));
|
|
|
|
|
|
|
|
const CACHE_PREF_NAME = "social.cached.notificationIcons";
|
|
|
|
// provider.profile == undefined means no response yet from the provider
|
|
|
|
// to tell us whether the user is logged in or not.
|
2012-10-23 07:47:29 +00:00
|
|
|
if (!Social.provider || !Social.provider.enabled ||
|
|
|
|
(!SocialUI.haveLoggedInUser() && provider.profile !== undefined)) {
|
|
|
|
// Either no enabled provider, or there is a provider and it has
|
|
|
|
// responded with a profile and the user isn't loggedin. The icons
|
|
|
|
// etc have already been removed by updateButtonHiddenState, so we want
|
|
|
|
// to nuke any cached icons we have and get out of here!
|
2012-10-08 00:15:02 +00:00
|
|
|
Services.prefs.clearUserPref(CACHE_PREF_NAME);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (Social.provider.profile === undefined) {
|
|
|
|
// provider has not told us about the login state yet - see if we have
|
|
|
|
// a cached version for this provider.
|
|
|
|
let cached;
|
|
|
|
try {
|
|
|
|
cached = JSON.parse(Services.prefs.getCharPref(CACHE_PREF_NAME));
|
|
|
|
} catch (ex) {}
|
|
|
|
if (cached && cached.provider == Social.provider.origin && cached.data) {
|
|
|
|
icons = cached.data;
|
|
|
|
iconNames = Object.keys(icons);
|
|
|
|
// delete the counter data as it is almost certainly stale.
|
|
|
|
for each(let name in iconNames) {
|
|
|
|
icons[name].counter = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// We have a logged in user - save the current set of icons back to the
|
|
|
|
// "cache" so we can use them next startup.
|
|
|
|
Services.prefs.setCharPref(CACHE_PREF_NAME,
|
|
|
|
JSON.stringify({provider: Social.provider.origin,
|
|
|
|
data: icons}));
|
|
|
|
}
|
|
|
|
|
2012-08-22 20:56:14 +00:00
|
|
|
let notificationFrames = document.createDocumentFragment();
|
2012-08-17 01:02:23 +00:00
|
|
|
let iconContainers = document.createDocumentFragment();
|
|
|
|
|
2012-10-06 00:22:09 +00:00
|
|
|
let createdFrames = [];
|
|
|
|
|
2012-08-17 01:02:23 +00:00
|
|
|
for each(let name in iconNames) {
|
2012-10-08 00:15:02 +00:00
|
|
|
let icon = icons[name];
|
2012-08-17 01:02:23 +00:00
|
|
|
|
2012-08-22 20:56:14 +00:00
|
|
|
let notificationFrameId = "social-status-" + icon.name;
|
|
|
|
let notificationFrame = document.getElementById(notificationFrameId);
|
|
|
|
if (!notificationFrame) {
|
|
|
|
notificationFrame = document.createElement("iframe");
|
|
|
|
notificationFrame.setAttribute("type", "content");
|
2012-09-06 23:13:37 +00:00
|
|
|
notificationFrame.setAttribute("class", "social-panel-frame");
|
2012-08-22 20:56:14 +00:00
|
|
|
notificationFrame.setAttribute("id", notificationFrameId);
|
|
|
|
notificationFrame.setAttribute("mozbrowser", "true");
|
2012-10-05 04:00:53 +00:00
|
|
|
// work around bug 793057 - by making the panel roughly the final size
|
|
|
|
// we are more likely to have the anchor in the correct position.
|
|
|
|
notificationFrame.style.width = PANEL_MIN_WIDTH + "px";
|
2012-10-06 00:22:09 +00:00
|
|
|
|
|
|
|
createdFrames.push(notificationFrame);
|
2012-08-22 20:56:14 +00:00
|
|
|
notificationFrames.appendChild(notificationFrame);
|
2012-07-15 23:12:13 +00:00
|
|
|
}
|
2012-08-22 20:56:14 +00:00
|
|
|
notificationFrame.setAttribute("origin", provider.origin);
|
|
|
|
if (notificationFrame.getAttribute("src") != icon.contentPanel)
|
|
|
|
notificationFrame.setAttribute("src", icon.contentPanel);
|
2012-08-17 01:02:23 +00:00
|
|
|
|
|
|
|
let iconId = "social-notification-icon-" + icon.name;
|
2012-09-27 23:57:37 +00:00
|
|
|
let imageId = iconId + "-image";
|
|
|
|
let labelId = iconId + "-label";
|
|
|
|
let stackId = iconId + "-stack";
|
|
|
|
let stack = document.getElementById(stackId);
|
|
|
|
let image, label;
|
|
|
|
if (stack) {
|
|
|
|
image = document.getElementById(imageId);
|
|
|
|
label = document.getElementById(labelId);
|
2012-08-17 01:02:23 +00:00
|
|
|
} else {
|
2012-09-27 23:57:37 +00:00
|
|
|
let box = document.createElement("box");
|
|
|
|
box.classList.add("toolbarbutton-1");
|
|
|
|
box.setAttribute("id", iconId);
|
2012-10-12 01:21:50 +00:00
|
|
|
// Use the accessibility menuitem label as tooltiptext.
|
|
|
|
if (icon.label)
|
|
|
|
box.setAttribute("tooltiptext", icon.label);
|
2012-10-03 20:57:13 +00:00
|
|
|
box.addEventListener("mousedown", function (e) {
|
|
|
|
if (e.button == 0)
|
|
|
|
SocialToolbar.showAmbientPopup(box);
|
|
|
|
}, false);
|
2012-09-27 23:57:37 +00:00
|
|
|
box.setAttribute("notificationFrameId", notificationFrameId);
|
|
|
|
stack = document.createElement("stack");
|
|
|
|
stack.setAttribute("id", stackId);
|
|
|
|
stack.classList.add("social-notification-icon-stack");
|
|
|
|
stack.classList.add("toolbarbutton-icon");
|
|
|
|
image = document.createElement("image");
|
|
|
|
image.setAttribute("id", imageId);
|
2012-10-05 20:06:39 +00:00
|
|
|
image.classList.add("social-notification-icon-image");
|
2012-09-27 23:57:37 +00:00
|
|
|
image = stack.appendChild(image);
|
|
|
|
label = document.createElement("label");
|
|
|
|
label.setAttribute("id", labelId);
|
|
|
|
label.classList.add("social-notification-icon-label");
|
|
|
|
let hbox = document.createElement("hbox");
|
|
|
|
hbox.classList.add("social-notification-icon-hbox");
|
|
|
|
hbox.setAttribute("align", "start");
|
|
|
|
hbox.setAttribute("pack", "end");
|
|
|
|
label = hbox.appendChild(label);
|
|
|
|
stack.appendChild(hbox);
|
|
|
|
box.appendChild(stack);
|
|
|
|
iconContainers.appendChild(box);
|
2012-09-29 10:17:29 +00:00
|
|
|
}
|
2012-09-27 23:57:37 +00:00
|
|
|
|
2012-09-27 23:57:37 +00:00
|
|
|
let labelValue = icon.counter || "";
|
|
|
|
// Only update the value attribute if it has changed to reduce layout changes.
|
|
|
|
if (!label.hasAttribute("value") || label.getAttribute("value") != labelValue)
|
|
|
|
label.setAttribute("value", labelValue);
|
|
|
|
|
|
|
|
if (image.getAttribute("src") != icon.iconURL)
|
|
|
|
image.setAttribute("src", icon.iconURL);
|
2012-08-17 01:02:23 +00:00
|
|
|
}
|
2012-10-16 06:58:13 +00:00
|
|
|
panel.appendChild(notificationFrames);
|
2012-08-17 01:02:23 +00:00
|
|
|
iconBox.appendChild(iconContainers);
|
2012-10-06 00:22:09 +00:00
|
|
|
|
|
|
|
for (let frame of createdFrames) {
|
|
|
|
if (frame.docShell) {
|
2012-10-06 00:22:09 +00:00
|
|
|
frame.docShell.isActive = false;
|
2012-10-06 00:22:09 +00:00
|
|
|
frame.docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Ci.nsIWebProgress)
|
|
|
|
.addProgressListener(new SocialErrorListener("notification-panel"),
|
|
|
|
Ci.nsIWebProgress.NOTIFY_STATE_REQUEST |
|
|
|
|
Ci.nsIWebProgress.NOTIFY_LOCATION);
|
|
|
|
}
|
|
|
|
}
|
2012-07-15 23:12:13 +00:00
|
|
|
},
|
|
|
|
|
2012-09-27 23:57:37 +00:00
|
|
|
showAmbientPopup: function SocialToolbar_showAmbientPopup(aToolbarButtonBox) {
|
2012-10-22 00:28:37 +00:00
|
|
|
// Hide any other social panels that may be open.
|
|
|
|
SocialFlyout.panel.hidePopup();
|
|
|
|
|
2012-07-15 23:12:13 +00:00
|
|
|
let panel = document.getElementById("social-notification-panel");
|
2012-09-27 23:57:37 +00:00
|
|
|
let notificationFrameId = aToolbarButtonBox.getAttribute("notificationFrameId");
|
|
|
|
let notificationFrame = document.getElementById(notificationFrameId);
|
2012-07-15 23:12:13 +00:00
|
|
|
|
2012-08-24 00:11:02 +00:00
|
|
|
// Clear dimensions on all browsers so the panel size will
|
|
|
|
// only use the selected browser.
|
2012-10-16 06:58:13 +00:00
|
|
|
let frameIter = panel.firstElementChild;
|
2012-08-24 00:11:02 +00:00
|
|
|
while (frameIter) {
|
|
|
|
frameIter.collapsed = (frameIter != notificationFrame);
|
|
|
|
frameIter = frameIter.nextElementSibling;
|
2012-07-15 23:12:13 +00:00
|
|
|
}
|
|
|
|
|
2012-08-20 18:25:47 +00:00
|
|
|
function dispatchPanelEvent(name) {
|
2012-08-22 20:56:14 +00:00
|
|
|
let evt = notificationFrame.contentDocument.createEvent("CustomEvent");
|
2012-08-20 18:25:47 +00:00
|
|
|
evt.initCustomEvent(name, true, true, {});
|
2012-08-22 20:56:14 +00:00
|
|
|
notificationFrame.contentDocument.documentElement.dispatchEvent(evt);
|
2012-08-20 18:25:47 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 03:32:38 +00:00
|
|
|
let dynamicResizer = this._dynamicResizer;
|
2012-08-24 00:10:07 +00:00
|
|
|
panel.addEventListener("popuphidden", function onpopuphiding() {
|
|
|
|
panel.removeEventListener("popuphidden", onpopuphiding);
|
2012-09-27 23:57:37 +00:00
|
|
|
aToolbarButtonBox.removeAttribute("open");
|
2012-10-05 03:32:38 +00:00
|
|
|
dynamicResizer.stop();
|
2012-08-24 00:10:07 +00:00
|
|
|
notificationFrame.docShell.isActive = false;
|
2012-08-20 18:25:47 +00:00
|
|
|
dispatchPanelEvent("socialFrameHide");
|
|
|
|
});
|
|
|
|
|
|
|
|
panel.addEventListener("popupshown", function onpopupshown() {
|
|
|
|
panel.removeEventListener("popupshown", onpopupshown);
|
2012-09-27 23:57:37 +00:00
|
|
|
aToolbarButtonBox.setAttribute("open", "true");
|
2012-08-24 00:10:07 +00:00
|
|
|
notificationFrame.docShell.isActive = true;
|
2012-08-22 20:56:14 +00:00
|
|
|
notificationFrame.docShell.isAppTab = true;
|
|
|
|
if (notificationFrame.contentDocument.readyState == "complete") {
|
2012-10-08 06:14:55 +00:00
|
|
|
dynamicResizer.start(panel, notificationFrame);
|
2012-08-20 18:25:47 +00:00
|
|
|
dispatchPanelEvent("socialFrameShow");
|
|
|
|
} else {
|
|
|
|
// first time load, wait for load and dispatch after load
|
2012-08-22 20:56:14 +00:00
|
|
|
notificationFrame.addEventListener("load", function panelBrowserOnload(e) {
|
|
|
|
notificationFrame.removeEventListener("load", panelBrowserOnload, true);
|
2012-10-08 06:14:55 +00:00
|
|
|
dynamicResizer.start(panel, notificationFrame);
|
2012-08-20 18:25:47 +00:00
|
|
|
setTimeout(function() {
|
|
|
|
dispatchPanelEvent("socialFrameShow");
|
|
|
|
}, 0);
|
|
|
|
}, true);
|
|
|
|
}
|
2012-07-15 23:12:13 +00:00
|
|
|
});
|
|
|
|
|
2012-09-27 23:57:37 +00:00
|
|
|
let imageId = aToolbarButtonBox.getAttribute("id") + "-image";
|
|
|
|
let toolbarButtonImage = document.getElementById(imageId);
|
|
|
|
panel.openPopup(toolbarButtonImage, "bottomcenter topleft", 0, 0, false, false);
|
2012-10-06 00:22:09 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setPanelErrorMessage: function SocialToolbar_setPanelErrorMessage(aNotificationFrame) {
|
|
|
|
if (!aNotificationFrame)
|
|
|
|
return;
|
|
|
|
|
|
|
|
let src = aNotificationFrame.getAttribute("src");
|
|
|
|
aNotificationFrame.removeAttribute("src");
|
|
|
|
aNotificationFrame.webNavigation.loadURI("about:socialerror?mode=tryAgainOnly&url=" +
|
|
|
|
encodeURIComponent(src), null, null, null, null);
|
|
|
|
sizeSocialPanelToContent(aNotificationFrame);
|
2012-07-15 23:12:13 +00:00
|
|
|
}
|
|
|
|
}
|
2012-07-18 18:40:05 +00:00
|
|
|
|
|
|
|
var SocialSidebar = {
|
|
|
|
// Called once, after window load, when the Social.provider object is initialized
|
|
|
|
init: function SocialSidebar_init() {
|
2012-10-30 03:52:56 +00:00
|
|
|
let sbrowser = document.getElementById("social-sidebar-browser");
|
|
|
|
this.errorListener = new SocialErrorListener("sidebar");
|
|
|
|
this.configureSidebarDocShell(sbrowser.docShell);
|
2012-07-18 18:40:05 +00:00
|
|
|
this.updateSidebar();
|
|
|
|
},
|
|
|
|
|
2012-10-30 03:52:56 +00:00
|
|
|
configureSidebarDocShell: function SocialSidebar_configureDocShell(aDocShell) {
|
|
|
|
// setting isAppTab causes clicks on untargeted links to open new tabs
|
|
|
|
aDocShell.isAppTab = true;
|
|
|
|
aDocShell.QueryInterface(Ci.nsIWebProgress)
|
|
|
|
.addProgressListener(SocialSidebar.errorListener,
|
|
|
|
Ci.nsIWebProgress.NOTIFY_STATE_REQUEST |
|
|
|
|
Ci.nsIWebProgress.NOTIFY_LOCATION);
|
|
|
|
},
|
|
|
|
|
2012-07-18 18:40:05 +00:00
|
|
|
// Whether the sidebar can be shown for this window.
|
|
|
|
get canShow() {
|
|
|
|
return Social.uiVisible && Social.provider.sidebarURL && !this.chromeless;
|
|
|
|
},
|
|
|
|
|
|
|
|
// Whether this is a "chromeless window" (e.g. popup window). We don't show
|
|
|
|
// the sidebar in these windows.
|
|
|
|
get chromeless() {
|
|
|
|
let docElem = document.documentElement;
|
|
|
|
return docElem.getAttribute('disablechrome') ||
|
2012-10-04 06:59:32 +00:00
|
|
|
docElem.getAttribute('chromehidden').contains("toolbar");
|
2012-07-18 18:40:05 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// Whether the user has toggled the sidebar on (for windows where it can appear)
|
2012-10-03 23:11:52 +00:00
|
|
|
get opened() {
|
|
|
|
return Services.prefs.getBoolPref("social.sidebar.open") && !document.mozFullScreen;
|
2012-07-18 18:40:05 +00:00
|
|
|
},
|
|
|
|
|
2012-10-30 03:52:56 +00:00
|
|
|
setSidebarVisibilityState: function(aEnabled) {
|
2012-08-03 21:42:40 +00:00
|
|
|
let sbrowser = document.getElementById("social-sidebar-browser");
|
2012-10-30 03:52:56 +00:00
|
|
|
sbrowser.docShell.isActive = aEnabled;
|
2012-08-03 21:42:40 +00:00
|
|
|
let evt = sbrowser.contentDocument.createEvent("CustomEvent");
|
2012-10-30 03:52:56 +00:00
|
|
|
evt.initCustomEvent(aEnabled ? "socialFrameShow" : "socialFrameHide", true, true, {});
|
2012-08-03 21:42:40 +00:00
|
|
|
sbrowser.contentDocument.documentElement.dispatchEvent(evt);
|
|
|
|
},
|
|
|
|
|
2012-07-18 18:40:05 +00:00
|
|
|
updateSidebar: function SocialSidebar_updateSidebar() {
|
2012-10-24 00:09:59 +00:00
|
|
|
clearTimeout(this._unloadTimeoutId);
|
2012-07-18 18:40:05 +00:00
|
|
|
// Hide the toggle menu item if the sidebar cannot appear
|
|
|
|
let command = document.getElementById("Social:ToggleSidebar");
|
2012-10-23 07:47:33 +00:00
|
|
|
command.setAttribute("hidden", this.canShow ? "false" : "true");
|
2012-07-18 18:40:05 +00:00
|
|
|
|
|
|
|
// Hide the sidebar if it cannot appear, or has been toggled off.
|
|
|
|
// Also set the command "checked" state accordingly.
|
2012-10-03 23:11:52 +00:00
|
|
|
let hideSidebar = !this.canShow || !this.opened;
|
2012-07-18 18:40:05 +00:00
|
|
|
let broadcaster = document.getElementById("socialSidebarBroadcaster");
|
|
|
|
broadcaster.hidden = hideSidebar;
|
|
|
|
command.setAttribute("checked", !hideSidebar);
|
|
|
|
|
|
|
|
let sbrowser = document.getElementById("social-sidebar-browser");
|
2012-08-03 21:42:40 +00:00
|
|
|
if (hideSidebar) {
|
2012-10-30 03:52:56 +00:00
|
|
|
this.setSidebarVisibilityState(false);
|
2012-10-24 00:09:59 +00:00
|
|
|
// If we've been disabled, unload the sidebar content immediately;
|
|
|
|
// if the sidebar was just toggled to invisible, wait a timeout
|
|
|
|
// before unloading.
|
2012-08-03 21:42:40 +00:00
|
|
|
if (!this.canShow) {
|
2012-10-24 00:09:59 +00:00
|
|
|
this.unloadSidebar();
|
|
|
|
} else {
|
|
|
|
this._unloadTimeoutId = setTimeout(
|
|
|
|
this.unloadSidebar,
|
|
|
|
Services.prefs.getIntPref("social.sidebar.unload_timeout_ms")
|
|
|
|
);
|
2012-08-03 21:42:40 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Make sure the right sidebar URL is loaded
|
|
|
|
if (sbrowser.getAttribute("origin") != Social.provider.origin) {
|
|
|
|
sbrowser.setAttribute("origin", Social.provider.origin);
|
|
|
|
sbrowser.setAttribute("src", Social.provider.sidebarURL);
|
|
|
|
sbrowser.addEventListener("load", function sidebarOnShow() {
|
2012-10-30 03:52:56 +00:00
|
|
|
sbrowser.removeEventListener("load", sidebarOnShow, true);
|
2012-08-03 21:42:40 +00:00
|
|
|
// let load finish, then fire our event
|
|
|
|
setTimeout(function () {
|
2012-10-30 03:52:56 +00:00
|
|
|
SocialSidebar.setSidebarVisibilityState(true);
|
2012-08-03 21:42:40 +00:00
|
|
|
}, 0);
|
2012-10-30 03:52:56 +00:00
|
|
|
}, true);
|
2012-08-03 21:42:40 +00:00
|
|
|
} else {
|
2012-10-30 03:52:56 +00:00
|
|
|
this.setSidebarVisibilityState(true);
|
2012-08-03 21:42:40 +00:00
|
|
|
}
|
2012-07-18 18:40:05 +00:00
|
|
|
}
|
2012-10-06 00:22:09 +00:00
|
|
|
},
|
|
|
|
|
2012-10-24 00:09:59 +00:00
|
|
|
unloadSidebar: function SocialSidebar_unloadSidebar() {
|
|
|
|
let sbrowser = document.getElementById("social-sidebar-browser");
|
|
|
|
if (!sbrowser.hasAttribute("origin"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Bug 803255 - If we don't remove the sidebar browser from the DOM,
|
|
|
|
// the previous document leaks because it's only released when the
|
|
|
|
// sidebar is made visible again.
|
|
|
|
let container = sbrowser.parentNode;
|
|
|
|
container.removeChild(sbrowser);
|
|
|
|
sbrowser.removeAttribute("origin");
|
|
|
|
sbrowser.removeAttribute("src");
|
2012-10-30 03:52:56 +00:00
|
|
|
|
|
|
|
function resetDocShell(docshellSupports) {
|
|
|
|
let docshell = docshellSupports.QueryInterface(Ci.nsIDocShell);
|
|
|
|
if (docshell.chromeEventHandler != sbrowser)
|
|
|
|
return;
|
|
|
|
|
|
|
|
SocialSidebar.configureSidebarDocShell(docshell);
|
|
|
|
|
|
|
|
Services.obs.removeObserver(resetDocShell, "webnavigation-create");
|
|
|
|
}
|
|
|
|
Services.obs.addObserver(resetDocShell, "webnavigation-create", false);
|
|
|
|
|
2012-10-24 00:09:59 +00:00
|
|
|
container.appendChild(sbrowser);
|
|
|
|
|
|
|
|
SocialFlyout.unload();
|
|
|
|
},
|
|
|
|
|
|
|
|
_unloadTimeoutId: 0,
|
|
|
|
|
2012-10-06 00:22:09 +00:00
|
|
|
setSidebarErrorMessage: function() {
|
|
|
|
let sbrowser = document.getElementById("social-sidebar-browser");
|
|
|
|
let url = encodeURIComponent(Social.provider.sidebarURL);
|
|
|
|
sbrowser.loadURI("about:socialerror?mode=tryAgain&url=" + url, null, null);
|
2012-07-18 18:40:05 +00:00
|
|
|
}
|
|
|
|
}
|
2012-10-06 00:22:09 +00:00
|
|
|
|
|
|
|
// Error handling class used to listen for network errors in the social frames
|
|
|
|
// and replace them with a social-specific error page
|
|
|
|
function SocialErrorListener(aType) {
|
|
|
|
this.type = aType;
|
|
|
|
}
|
|
|
|
|
|
|
|
SocialErrorListener.prototype = {
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
|
|
|
|
Ci.nsISupportsWeakReference,
|
|
|
|
Ci.nsISupports]),
|
|
|
|
|
|
|
|
onStateChange: function SPL_onStateChange(aWebProgress, aRequest, aState, aStatus) {
|
|
|
|
let failure = false;
|
|
|
|
if ((aState & Ci.nsIWebProgressListener.STATE_STOP)) {
|
|
|
|
if (aRequest instanceof Ci.nsIHttpChannel) {
|
|
|
|
try {
|
|
|
|
// Change the frame to an error page on 4xx (client errors)
|
|
|
|
// and 5xx (server errors)
|
|
|
|
failure = aRequest.responseStatus >= 400 &&
|
|
|
|
aRequest.responseStatus < 600;
|
|
|
|
} catch (e) {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calling cancel() will raise some OnStateChange notifications by itself,
|
|
|
|
// so avoid doing that more than once
|
|
|
|
if (failure && aStatus != Components.results.NS_BINDING_ABORTED) {
|
|
|
|
aRequest.cancel(Components.results.NS_BINDING_ABORTED);
|
|
|
|
this.setErrorMessage(aWebProgress);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onLocationChange: function SPL_onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
|
|
|
|
let failure = aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE;
|
|
|
|
if (failure) {
|
|
|
|
aRequest.cancel(Components.results.NS_BINDING_ABORTED);
|
|
|
|
window.setTimeout(function(self) {
|
|
|
|
self.setErrorMessage(aWebProgress);
|
|
|
|
}, 0, this);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onProgressChange: function SPL_onProgressChange() {},
|
|
|
|
onStatusChange: function SPL_onStatusChange() {},
|
|
|
|
onSecurityChange: function SPL_onSecurityChange() {},
|
|
|
|
|
|
|
|
setErrorMessage: function(aWebProgress) {
|
|
|
|
switch (this.type) {
|
|
|
|
case "flyout":
|
|
|
|
SocialFlyout.setFlyoutErrorMessage();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "sidebar":
|
|
|
|
SocialSidebar.setSidebarErrorMessage();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "notification-panel":
|
|
|
|
let frame = aWebProgress.QueryInterface(Ci.nsIDocShell)
|
|
|
|
.chromeEventHandler;
|
|
|
|
SocialToolbar.setPanelErrorMessage(frame);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|