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
Родитель 5f0fd7aeda
Коммит 12492732ec
2 изменённых файлов: 20 добавлений и 22 удалений

Просмотреть файл

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

Просмотреть файл

@ -50,17 +50,6 @@
</setter>
</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">
<body><![CDATA[
this.parentNode.remove(this);
@ -376,7 +365,9 @@
cb.setAttribute("minimized", "true");
this.selectedChat = cb;
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.resize();
]]></body>