Bug 807935 - social chatbar should be hidden in full-screen mode. r=jaws

This commit is contained in:
Mark Hammond 2012-11-13 14:52:06 +11:00
parent 5f0fd7aeda
commit 12492732ec
2 changed files with 20 additions and 22 deletions

View file

@ -20,7 +20,10 @@ let SocialUI = {
gBrowser.addEventListener("ActivateSocialFeature", this._activationEventHandler, true, true); gBrowser.addEventListener("ActivateSocialFeature", this._activationEventHandler, true, true);
// Called when we enter DOM full-screen mode. // Called when we enter DOM full-screen mode.
window.addEventListener("mozfullscreenchange", function () SocialSidebar.updateSidebar()); window.addEventListener("mozfullscreenchange", function () {
SocialSidebar.update();
SocialChatBar.update();
});
Social.init(this._providerReady.bind(this)); Social.init(this._providerReady.bind(this));
}, },
@ -54,7 +57,7 @@ let SocialUI = {
this.updateToggleCommand(); this.updateToggleCommand();
SocialShareButton.updateButtonHiddenState(); SocialShareButton.updateButtonHiddenState();
SocialToolbar.updateButtonHiddenState(); SocialToolbar.updateButtonHiddenState();
SocialSidebar.updateSidebar(); SocialSidebar.update();
SocialChatBar.update(); SocialChatBar.update();
SocialFlyout.unload(); SocialFlyout.unload();
} catch (e) { } catch (e) {
@ -78,7 +81,7 @@ let SocialUI = {
} }
break; break;
case "nsPref:changed": case "nsPref:changed":
SocialSidebar.updateSidebar(); SocialSidebar.update();
SocialToolbar.updateButton(); SocialToolbar.updateButton();
SocialMenu.populate(); SocialMenu.populate();
break; break;
@ -229,22 +232,26 @@ let SocialChatBar = {
get chatbar() { get chatbar() {
return document.getElementById("pinnedchats"); return document.getElementById("pinnedchats");
}, },
// Whether the chats can be shown for this window. // Whether the chatbar is available for this window. Note that in full-screen
get canShow() { // mode chats are available, but not shown.
get isAvailable() {
if (!SocialUI.haveLoggedInUser()) if (!SocialUI.haveLoggedInUser())
return false; return false;
let docElem = document.documentElement; let docElem = document.documentElement;
let chromeless = docElem.getAttribute("disablechrome") || let chromeless = docElem.getAttribute("disablechrome") ||
docElem.getAttribute("chromehidden").indexOf("extrachrome") >= 0; docElem.getAttribute("chromehidden").indexOf("extrachrome") >= 0;
return Social.uiVisible && !chromeless && !document.mozFullScreen; return Social.uiVisible && !chromeless;
}, },
openChat: function(aProvider, aURL, aCallback, aMode) { openChat: function(aProvider, aURL, aCallback, aMode) {
if (this.canShow) if (this.isAvailable)
this.chatbar.openChat(aProvider, aURL, aCallback, aMode); this.chatbar.openChat(aProvider, aURL, aCallback, aMode);
}, },
update: function() { update: function() {
if (!this.canShow) if (!this.isAvailable)
this.chatbar.removeAll(); this.chatbar.removeAll();
else {
this.chatbar.hidden = document.mozFullScreen;
}
}, },
focus: function SocialChatBar_focus() { focus: function SocialChatBar_focus() {
let commandDispatcher = gBrowser.ownerDocument.commandDispatcher; let commandDispatcher = gBrowser.ownerDocument.commandDispatcher;
@ -943,7 +950,7 @@ var SocialSidebar = {
let sbrowser = document.getElementById("social-sidebar-browser"); let sbrowser = document.getElementById("social-sidebar-browser");
this.errorListener = new SocialErrorListener("sidebar"); this.errorListener = new SocialErrorListener("sidebar");
this.configureSidebarDocShell(sbrowser.docShell); this.configureSidebarDocShell(sbrowser.docShell);
this.updateSidebar(); this.update();
}, },
configureSidebarDocShell: function SocialSidebar_configureDocShell(aDocShell) { configureSidebarDocShell: function SocialSidebar_configureDocShell(aDocShell) {
@ -981,7 +988,7 @@ var SocialSidebar = {
sbrowser.contentDocument.documentElement.dispatchEvent(evt); sbrowser.contentDocument.documentElement.dispatchEvent(evt);
}, },
updateSidebar: function SocialSidebar_updateSidebar() { update: function SocialSidebar_update() {
clearTimeout(this._unloadTimeoutId); clearTimeout(this._unloadTimeoutId);
// Hide the toggle menu item if the sidebar cannot appear // Hide the toggle menu item if the sidebar cannot appear
let command = document.getElementById("Social:ToggleSidebar"); let command = document.getElementById("Social:ToggleSidebar");

View file

@ -50,17 +50,6 @@
</setter> </setter>
</property> </property>
<method name="init">
<parameter name="aProvider"/>
<parameter name="aURL"/>
<parameter name="aCallback"/>
<body><![CDATA[
this._callback = aCallback;
this.setAttribute("origin", aProvider.origin);
this.setAttribute("src", aURL);
]]></body>
</method>
<method name="close"> <method name="close">
<body><![CDATA[ <body><![CDATA[
this.parentNode.remove(this); this.parentNode.remove(this);
@ -376,7 +365,9 @@
cb.setAttribute("minimized", "true"); cb.setAttribute("minimized", "true");
this.selectedChat = cb; this.selectedChat = cb;
this.insertBefore(cb, this.firstChild); this.insertBefore(cb, this.firstChild);
cb.init(aProvider, aURL, aCallback); cb._callback = aCallback;
cb.setAttribute("origin", aProvider.origin);
cb.setAttribute("src", aURL);
this.chatboxForURL.set(aURL, Cu.getWeakReference(cb)); this.chatboxForURL.set(aURL, Cu.getWeakReference(cb));
this.resize(); this.resize();
]]></body> ]]></body>