[Pkg-mozext-commits] [firebug] 41/56: Issue 7685 - introducing notification popup for Aurora
David Prévot
taffit at moszumanska.debian.org
Wed Nov 19 21:01:45 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firebug.
commit dd0c721621fbd6f2d670c14f1e17bf3fe9a2f287
Author: Jan Odvarko <odvarko at gmail.com>
Date: Wed Oct 29 17:31:52 2014 +0100
Issue 7685 - introducing notification popup for Aurora
---
.../firebug/firefox/auroraNotificationPanel.xml | 124 +++++++++++++++++++++
.../content/firebug/firefox/browserOverlay.css | 9 +-
.../content/firebug/firefox/browserOverlay.js | 65 +++++++++++
.../firebug/firefox/start-button/startButton.xml | 24 +++-
.../en-US/multiprocess-notification.properties | 13 ++-
5 files changed, 229 insertions(+), 6 deletions(-)
diff --git a/extension/content/firebug/firefox/auroraNotificationPanel.xml b/extension/content/firebug/firefox/auroraNotificationPanel.xml
new file mode 100644
index 0000000..c9a24e1
--- /dev/null
+++ b/extension/content/firebug/firefox/auroraNotificationPanel.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<!-- See license.txt for terms of usage -->
+
+<bindings xmlns="http://www.mozilla.org/xbl"
+ xmlns:xbl="http://www.mozilla.org/xbl"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml">
+
+<binding id="panel">
+ <resources>
+ <stylesheet src="chrome://global/skin/notification.css"/>
+ </resources>
+ <content>
+ <xul:panel anonid="panel" norestorefocus="true" noautofocus="true"
+ ignorekeys="true" role="presentation" type="arrow" class="panel">
+ <xul:hbox>
+ <xul:vbox class="iconbox">
+ <xul:image src="chrome://firebug/skin/firebug64.png"/>
+ </xul:vbox>
+ <xul:vbox>
+ <xul:description anonid="desc" class="desc" />
+ <xul:description anonid="desc2" class="desc" />
+ <xul:label anonid="learnMore"
+ class="text-link popup-notification-learnmore-link learnMore"
+ href="https://getfirebug.com/"/>
+ <xul:hbox align="right">
+ <xul:progressmeter anonid="progress" class="progress"
+ mode="determined" value="0" collapsed="true"/>
+ <xul:spacer width="20px" />
+ <xul:button anonid="upgrade" type="menu-button"
+ xbl:inherits="oncommand=upgradecommand"
+ class="popup-notification-menubutton">
+ <xul:menupopup>
+ <xul:menuitem anonid="notnow"
+ xbl:inherits="oncommand=notnowcommand"/>
+ <xul:menuitem anonid="nothanks"
+ xbl:inherits="oncommand=nothankscommand"/>
+ </xul:menupopup>
+ </xul:button>
+ <xul:button anonid="cancel" type="button" collapsed="true"
+ xbl:inherits="oncommand=cancelcommand">
+ </xul:button>
+ </xul:hbox>
+ </xul:vbox>
+ </xul:hbox>
+ </xul:panel>
+ </content>
+
+ <implementation>
+ <constructor><![CDATA[
+ ]]></constructor>
+
+ <method name="internationalize">
+ <parameter name="Locale" />
+ <body><![CDATA[
+ var desc = document.getAnonymousElementByAttribute(this, "anonid", "desc");
+ desc.textContent = Locale.$STR("aurora.description");
+
+ var desc2 = document.getAnonymousElementByAttribute(this, "anonid", "desc2");
+ desc2.textContent = Locale.$STR("aurora.description2");
+
+ var learnMore = document.getAnonymousElementByAttribute(this, "anonid", "learnMore");
+ learnMore.textContent = Locale.$STR("multiprocess.learnMore");
+
+ var upgradeButton = document.getAnonymousElementByAttribute(this, "anonid", "upgrade");
+ upgradeButton.label = Locale.$STR("multiprocess.upgrade");
+
+ var notNowMenu = document.getAnonymousElementByAttribute(this, "anonid", "notnow");
+ notNowMenu.label = Locale.$STR("aurora.notnow");
+
+ var noThanksMenu = document.getAnonymousElementByAttribute(this, "anonid", "nothanks");
+ noThanksMenu.label = Locale.$STR("aurora.nothanks");
+
+ var cancelButton = document.getAnonymousElementByAttribute(this, "anonid", "cancel");
+ cancelButton.label = Locale.$STR("multiprocess.cancel");
+ ]]></body>
+ </method>
+
+ <method name="open">
+ <body><![CDATA[
+ var offsetY = 0;
+ var offsetX = 0;
+ var target = document.getElementById("nav-bar-customization-target");
+
+ var startButton = document.getElementById("firebug-button");
+ if (startButton) {
+ var style = document.defaultView.getComputedStyle(startButton.button);
+ offsetY = parseInt(style["padding-bottom"]);
+ offsetX = parseInt(style["width"])/2;
+ target = startButton.button;
+ }
+
+ this.panel = document.getAnonymousElementByAttribute(this, "anonid", "panel");
+ this.panel.openPopup(target, "after_end", -offsetX, -offsetY, false, false);
+ ]]></body>
+ </method>
+
+ <method name="close">
+ <body><![CDATA[
+ this.panel.hidePopup();
+ this.panel = null;
+ ]]></body>
+ </method>
+
+ <property name="progress">
+ <getter><![CDATA[
+ return document.getAnonymousElementByAttribute(this, "anonid", "progress");
+ ]]></getter>
+ </property>
+
+ <property name="upgradeButton">
+ <getter><![CDATA[
+ return document.getAnonymousElementByAttribute(this, "anonid", "upgrade");
+ ]]></getter>
+ </property>
+
+ <property name="cancelButton">
+ <getter><![CDATA[
+ return document.getAnonymousElementByAttribute(this, "anonid", "cancel");
+ ]]></getter>
+ </property>
+ </implementation>
+</binding>
+</bindings>
diff --git a/extension/content/firebug/firefox/browserOverlay.css b/extension/content/firebug/firefox/browserOverlay.css
index 2d10ae7..07b1fd8 100644
--- a/extension/content/firebug/firefox/browserOverlay.css
+++ b/extension/content/firebug/firefox/browserOverlay.css
@@ -200,10 +200,16 @@ fbMultiprocessNotificationPanel {
-moz-binding: url("chrome://firebug/content/firefox/multiprocessNotificationPanel.xml#panel");
}
-fbMultiprocessNotificationPanel .iconbox{
+fbAuroraNotificationPanel {
+ -moz-binding: url("chrome://firebug/content/firefox/auroraNotificationPanel.xml#panel");
+}
+
+fbAuroraNotificationPanel .iconbox,
+fbMultiprocessNotificationPanel .iconbox {
padding-right: 10px;
}
+fbAuroraNotificationPanel .desc,
fbMultiprocessNotificationPanel .desc {
max-width: 300px;
}
@@ -224,6 +230,7 @@ fbMultiprocessNotificationPanel .warningicon {
margin-right: 4px;
}
+fbAuroraNotificationPanel .progress,
fbMultiprocessNotificationPanel .progress {
margin: 8px;
}
diff --git a/extension/content/firebug/firefox/browserOverlay.js b/extension/content/firebug/firefox/browserOverlay.js
index 557a9ed..4d56d3e 100644
--- a/extension/content/firebug/firefox/browserOverlay.js
+++ b/extension/content/firebug/firefox/browserOverlay.js
@@ -137,6 +137,10 @@ BrowserOverlay.prototype =
this.showMultiprocessNotification();
return;
}
+ else if (this.isAuroraChannel()) {
+ this.showAuroraNotification();
+ return;
+ }
if (this.win.Firebug.waitingForFirstLoad)
return;
@@ -611,6 +615,67 @@ BrowserOverlay.prototype =
return false;
},
+ isAuroraChannel: function() {
+ if (this.notNow)
+ return false;
+
+ if (Options.get("noThanksFirebugNext"))
+ return false;
+
+ return (servicesScope.Services.prefs.getCharPref("app.update.channel") == "aurora");
+ },
+
+ showAuroraNotification: function()
+ {
+ var popupSet = $(this.doc, "mainPopupSet");
+ var panel = this.doc.querySelector("fbAuroraNotificationPanel");
+ if (!panel)
+ {
+ panel = this.doc.createElement("fbAuroraNotificationPanel");
+ panel.setAttribute("upgradecommand", "Firebug.browserOverlay.onUpgradeFirebug(event)");
+ panel.setAttribute("notnowcommand", "Firebug.browserOverlay.onNotNow(event)");
+ panel.setAttribute("nothankscommand", "Firebug.browserOverlay.onNoThanks(event)");
+ panel.setAttribute("cancelcommand", "Firebug.browserOverlay.onCancelUpgrade(event)");
+ popupSet.appendChild(panel);
+ }
+
+ panel.internationalize(Locale);
+ panel.open();
+ },
+
+ onNoThanks: function(event)
+ {
+ Events.cancelEvent(event);
+
+ // Not sure why the timeout needs to be here, but the 'close'
+ // method is only available asynchronously.
+ this.win.setTimeout(() => {
+ Options.set("noThanksFirebugNext", true);
+ this.openFirebug2(event.target);
+ });
+ },
+
+ onNotNow: function(event)
+ {
+ Events.cancelEvent(event);
+
+ this.win.setTimeout(() => {
+ this.notNow = true;
+ this.openFirebug2(event.target);
+ });
+ },
+
+ openFirebug2: function(panel)
+ {
+ var button = this.doc.getElementById("firebug-button");
+ button.enableFirebugActions();
+ panel.close();
+
+ this.startFirebug(function(Firebug) {
+ Firebug.toggleBar(true);
+ });
+ },
+
showMultiprocessNotification: function()
{
var popupSet = $(this.doc, "mainPopupSet");
diff --git a/extension/content/firebug/firefox/start-button/startButton.xml b/extension/content/firebug/firefox/start-button/startButton.xml
index 3ac5360..aa933de 100644
--- a/extension/content/firebug/firefox/start-button/startButton.xml
+++ b/extension/content/firebug/firefox/start-button/startButton.xml
@@ -20,8 +20,11 @@
<implementation>
<constructor><![CDATA[
- if (Firebug.browserOverlay.isMultiprocessEnabled())
- this.mutliprocessEnabled();
+ if (Firebug.browserOverlay.isMultiprocessEnabled() ||
+ Firebug.browserOverlay.isAuroraChannel())
+ {
+ this.disableFirebugActions();
+ }
]]></constructor>
<property name="button">
@@ -30,7 +33,7 @@
]]></xbl:getter>
</property>
- <method name="mutliprocessEnabled">
+ <method name="disableFirebugActions">
<body><![CDATA[
this.removeAttribute("contextmenu");
this.setAttribute("type", "button");
@@ -43,6 +46,21 @@
dropMarker.setAttribute("collapsed", "true");
]]></body>
</method>
+
+ <method name="enableFirebugActions">
+ <body><![CDATA[
+ this.setAttribute("contextmenu", "fbStatusContextMenu");
+ this.setAttribute("type", "menu-button");
+
+ this.button.classList.add("toolbarbutton-menubutton-button");
+ this.button.classList.remove("toolbarbutton-1");
+ this.button.classList.remove("chromeclass-toolbar-additional");
+ var dropMarker = document.getAnonymousElementByAttribute(this,
+ "anonid", "dropmarker");
+ dropMarker.removeAttribute("collapsed");
+ ]]></body>
+ </method>
+
</implementation>
</binding>
diff --git a/extension/locale/en-US/multiprocess-notification.properties b/extension/locale/en-US/multiprocess-notification.properties
index f0774e7..6018336 100644
--- a/extension/locale/en-US/multiprocess-notification.properties
+++ b/extension/locale/en-US/multiprocess-notification.properties
@@ -1,4 +1,5 @@
-# LOCALIZATION NOTE (multiprocess.description, multiprocess.learnMore, multiprocess.warning):
+# LOCALIZATION NOTE (multiprocess.description, multiprocess.learnMore, multiprocess.warning,
+# multiprocess.upgrade, multiprocess.disable, multiprocess.cancel):
# Label used in a notification panel that is displayed when the user clicks on Firebug start
# button in multiprocess Firefox browser (e10s enabled browser).
multiprocess.description=You are running Firebug 2 in multiprocess Firefox browser (e10s). To continue using Firebug you need to upgrade to version 3.
@@ -6,4 +7,12 @@ multiprocess.learnMore=Learn more...
multiprocess.warning=You might want to disable multiprocess feature on this browser in order to continue using Firebug 2, but you will be at a significant performance, stability, and security disadvantage.
multiprocess.upgrade=Upgrade and Restart
multiprocess.disable=Disable e10s and Restart
-multiprocess.cancel=Cancel
\ No newline at end of file
+multiprocess.cancel=Cancel
+
+# LOCALIZATION NOTE (aurora.description, aurora.description2, aurora.notnow, aurora.nothanks):
+# Label used in a notification panel that is displayed when the user clicks on Firebug start
+# button in Aurora (Firefox) channel.
+aurora.description=Did you know that Firebug 3 (for testers) is available? This version is built on top of Firefox native developer tools and offers significant performance, stability, and security advantages.
+aurora.description2=Do you want to try it out?
+aurora.notnow=Not Now
+aurora.nothanks=No Thanks
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git
More information about the Pkg-mozext-commits
mailing list