diff --git a/mozilla/browser/base/content/browser.js b/mozilla/browser/base/content/browser.js
index 578e32249da..fee4a1c6361 100644
--- a/mozilla/browser/base/content/browser.js
+++ b/mozilla/browser/base/content/browser.js
@@ -328,9 +328,24 @@ const gPopupBlockerObserver = {
else
message = bundle_browser.getFormattedString("popupWarning", [brandShortName]);
- gBrowser.showMessage(gBrowser.selectedBrowser, "chrome://browser/skin/Info.png",
- message, popupButtonText, null, null, "blockedPopupOptions",
- "top", true, popupButtonAccesskey);
+ var notificationBox = gBrowser.getNotificationBox();
+ var notification = notificationBox.getNotificationWithValue("popup-blocked");
+ if (notification) {
+ notification.label = message;
+ }
+ else {
+ var buttons = [{
+ label: popupButtonText,
+ accessKey: popupButtonAccesskey,
+ popup: "blockedPopupOptions",
+ callback: null
+ }];
+
+ const priority = notificationBox.PRIORITY_WARNING_MEDIUM;
+ notificationBox.appendNotification(message, "popup-blocked",
+ "chrome://browser/skin/Info.png",
+ priority, buttons);
+ }
}
}
else
@@ -346,7 +361,7 @@ const gPopupBlockerObserver = {
var perm = shouldBlock ? this._kIPM.DENY_ACTION : this._kIPM.ALLOW_ACTION;
pm.add(currentURI, "popup", perm);
- gBrowser.hideMessage(null, "top");
+ gBrowser.getNotificationBox().removeCurrentNotification();
},
fillPopupList: function (aEvent)
@@ -515,7 +530,7 @@ const gPopupBlockerObserver = {
gPrefService.setBoolPref("privacy.popups.showBrowserMessage", !showMessage);
- gBrowser.hideMessage(null, "top");
+ gBrowser.getNotificationBox().removeCurrentNotification();
},
_displayPageReportFirstTime: function ()
@@ -564,82 +579,86 @@ const gXPInstallObserver = {
if (browser) {
var host = browser.docShell.QueryInterface(Components.interfaces.nsIWebNavigation).currentURI.host;
var brandShortName = brandBundle.getString("brandShortName");
- var iconURL, messageKey, buttonKey, buttonAccesskeyKey;
- if (aData == "install-chrome") {
+ var notificationName, messageString, buttons;
+ if (!gPrefService.getBoolPref("xpinstall.enabled")) {
+ notificationName = "xpinstall-disabled"
+ if (gPrefService.prefIsLocked("xpinstall.enabled")) {
+ messageString = browserBundle.getString("xpinstallDisabledMessageLocked");
+ buttons = [];
+ }
+ else {
+ messageString = browserBundle.getFormattedString("xpinstallDisabledMessage",
+ [brandShortName, host]);
+
+ buttons = [{
+ label: browserBundle.getString("xpinstallDisabledButton"),
+ accessKey: browserBundle.getString("xpinstallDisabledButton.accesskey"),
+ popup: null,
+ callback: function editPrefs() {
+ gPrefService.setBoolPref("xpinstall.enabled", true);
+ return false;
+ }
+ }];
+ }
+ }
+ else {
// XXXben - use regular software install warnings for now until we can
// properly differentiate themes. It's likely in fact that themes won't
// be blocked so this code path will only be reached for extensions.
- iconURL = "chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png";
- messageKey = "xpinstallWarning";
- buttonKey = "xpinstallWarningButton";
- buttonAccesskeyKey = "xpinstallWarningButton.accesskey";
- }
- else {
- iconURL = "chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png";
- messageKey = "xpinstallWarning";
- buttonKey = "xpinstallWarningButton";
- buttonAccesskeyKey = "xpinstallWarningButton.accesskey";
- }
- var messageString, buttonString, buttonAccesskeyString;
- if (!gPrefService.getBoolPref("xpinstall.enabled")) {
- if (gPrefService.prefIsLocked("xpinstall.enabled")) {
- messageString = browserBundle.getString("xpinstallDisabledMessageLocked");
- buttonString = ""; // don't show the button
- }
- else {
- messageString = browserBundle.getString("xpinstallDisabledMessage");
- buttonString = browserBundle.getString("xpinstallDisabledButton");
- buttonAccesskeyString = browserBundle.getString("xpinstallDisabledButton.accesskey");
- }
- getBrowser().showMessage(browser, iconURL, messageString, buttonString,
- null, "xpinstall-install-edit-prefs",
- null, "top", true, buttonAccesskeyString);
- }
- else {
- messageString = browserBundle.getFormattedString(messageKey, [brandShortName, host]);
- buttonString = browserBundle.getString(buttonKey);
- buttonAccesskeyString = browserBundle.getString(buttonAccesskeyKey);
- webNav = shell.QueryInterface(Components.interfaces.nsIWebNavigation);
- getBrowser().showMessage(browser, iconURL, messageString, buttonString,
- shell, "xpinstall-install-edit-permissions",
- null, "top", false, buttonAccesskeyString);
- }
- }
- break;
- case "xpinstall-install-edit-prefs":
- gPrefService.setBoolPref("xpinstall.enabled", true);
- getBrowser().hideMessage(null, "top");
- break;
- case "xpinstall-install-edit-permissions":
- browser = this._getBrowser(aSubject.QueryInterface(Components.interfaces.nsIDocShell));
- if (browser) {
- var bundlePreferences = document.getElementById("bundle_preferences");
- webNav = aSubject.QueryInterface(Components.interfaces.nsIWebNavigation);
- var params = { blockVisible : false,
- sessionVisible : false,
- allowVisible : true,
- prefilledHost : webNav.currentURI.host,
- permissionType : "install",
- windowTitle : bundlePreferences.getString("installpermissionstitle"),
- introText : bundlePreferences.getString("installpermissionstext") };
- wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var existingWindow = wm.getMostRecentWindow("Browser:Permissions");
- if (existingWindow) {
- existingWindow.initWithParams(params);
- existingWindow.focus();
- }
- else
- window.openDialog("chrome://browser/content/preferences/permissions.xul",
- "_blank", "resizable,dialog=no,centerscreen", params);
+ notificationName = "xpinstall"
+ messageString = browserBundle.getFormattedString("xpinstallWarning",
+ [brandShortName, host]);
- getBrowser().hideMessage(null, "top");
+ buttons = [{
+ label: browserBundle.getString("xpinstallWarningButton"),
+ accessKey: browserBundle.getString("xpinstallWarningButton.accesskey"),
+ popup: null,
+ callback: function() { return xpinstallEditPermissions(browser.docShell); }
+ }];
+ }
+
+ var notificationBox = gBrowser.getNotificationBox(browser);
+ if (!notificationBox.getNotificationWithValue(notificationName)) {
+ const priority = notificationBox.PRIORITY_WARNING_MEDIUM;
+ const iconURL = "chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png";
+ notificationBox.appendNotification(messageString, notificationName,
+ iconURL, priority, buttons);
+ }
}
break;
}
}
};
+function xpinstallEditPermissions(aDocShell)
+{
+ var browser = gXPInstallObserver._getBrowser(aDocShell);
+ if (browser) {
+ var bundlePreferences = document.getElementById("bundle_preferences");
+ var webNav = aDocShell.QueryInterface(Components.interfaces.nsIWebNavigation);
+ var params = { blockVisible : false,
+ sessionVisible : false,
+ allowVisible : true,
+ prefilledHost : webNav.currentURI.host,
+ permissionType : "install",
+ windowTitle : bundlePreferences.getString("installpermissionstitle"),
+ introText : bundlePreferences.getString("installpermissionstext") };
+ wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Components.interfaces.nsIWindowMediator);
+ var existingWindow = wm.getMostRecentWindow("Browser:Permissions");
+ if (existingWindow) {
+ existingWindow.initWithParams(params);
+ existingWindow.focus();
+ }
+ else
+ window.openDialog("chrome://browser/content/preferences/permissions.xul",
+ "_blank", "resizable,dialog=no,centerscreen", params);
+ return false;
+ }
+
+ return true;
+}
+
function BrowserStartup()
{
gBrowser = document.getElementById("content");
@@ -846,9 +865,6 @@ function delayedStartup()
var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
os.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
os.addObserver(gXPInstallObserver, "xpinstall-install-blocked", false);
- os.addObserver(gXPInstallObserver, "xpinstall-install-edit-prefs", false);
- os.addObserver(gXPInstallObserver, "xpinstall-install-edit-permissions", false);
- os.addObserver(gMissingPluginInstaller, "missing-plugin", false);
if (!gPrefService)
gPrefService = Components.classes["@mozilla.org/preferences-service;1"]
@@ -1007,9 +1023,6 @@ function BrowserShutdown()
.getService(Components.interfaces.nsIObserverService);
os.removeObserver(gSessionHistoryObserver, "browser:purge-session-history");
os.removeObserver(gXPInstallObserver, "xpinstall-install-blocked");
- os.removeObserver(gXPInstallObserver, "xpinstall-install-edit-permissions");
- os.removeObserver(gXPInstallObserver, "xpinstall-install-edit-prefs");
- os.removeObserver(gMissingPluginInstaller, "missing-plugin");
try {
gBrowser.removeProgressListener(window.XULBrowserWindow);
@@ -2443,9 +2456,9 @@ function toggleAffectedChrome(aHide)
gChromeState.sidebarOpen = !sidebar.hidden;
gSidebarCommand = sidebar.getAttribute("sidebarcommand");
- var message = gBrowser.getMessageForBrowser(gBrowser.selectedBrowser, "top");
- gChromeState.messageOpen = !message.hidden;
- message.hidden = aHide;
+ var notificationBox = gBrowser.getNotificationBox();
+ gChromeState.notificationsOpen = !notificationBox.notificationsHidden;
+ notificationBox.notificationsHidden = aHide;
var statusbar = document.getElementById("status-bar");
gChromeState.statusbarOpen = !statusbar.hidden;
@@ -2456,9 +2469,8 @@ function toggleAffectedChrome(aHide)
gFindBar.closeFindBar();
}
else {
- if (gChromeState.messageOpen) {
- var message = gBrowser.getMessageForBrowser(gBrowser.selectedBrowser, "top");
- message.hidden = aHide;
+ if (gChromeState.notificationsOpen) {
+ gBrowser.getNotificationBox().notificationsHidden = aHide;
}
if (gChromeState.statusbarOpen) {
@@ -3523,7 +3535,7 @@ nsBrowserStatusHandler.prototype =
if (newIndexOfHash != -1)
newSpec = newSpec.substr(0, newSpec.indexOf("#"));
if (newSpec != oldSpec) {
- getBrowser().hideMessage(null, "both");
+ gBrowser.getNotificationBox(selectedBrowser).removeAllNotifications(true);
}
}
selectedBrowser.lastURI = aLocation;
@@ -6003,7 +6015,8 @@ missingPluginInstaller.prototype.installSinglePlugin = function(aEvent){
if (missingPluginsArray) {
window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
- "PFSWindow", "modal,chrome,resizable=yes", {plugins: missingPluginsArray, tab: tabbrowser.mCurrentTab});
+ "PFSWindow", "modal,chrome,resizable=yes",
+ {plugins: missingPluginsArray, tab: tabbrowser.mCurrentTab});
}
aEvent.preventDefault();
@@ -6049,32 +6062,35 @@ missingPluginInstaller.prototype.newMissingPlugin = function(aEvent){
tab.missingPlugins[pluginInfo.mimetype] = pluginInfo;
var browser = tabbrowser.getBrowserAtIndex(i);
- var iconURL = "chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png";
+ var notificationBox = gBrowser.getNotificationBox(browser);
+ if (!notificationBox.getNotificationWithValue("missing-plugins")) {
+ var bundle_browser = document.getElementById("bundle_browser");
+ var messageString = bundle_browser.getString("missingpluginsMessage.title");
+ var buttons = [{
+ label: bundle_browser.getString("missingpluginsMessage.button.label"),
+ accessKey: bundle_browser.getString("missingpluginsMessage.button.accesskey"),
+ popup: null,
+ callback: pluginsMissing
+ }];
- var bundle_browser = document.getElementById("bundle_browser");
- var messageString = bundle_browser.getString("missingpluginsMessage.title");
- var buttonString = bundle_browser.getString("missingpluginsMessage.button.label");
- var buttonAccesskeyString = bundle_browser.getString("missingpluginsMessage.button.accesskey");
-
- tabbrowser.showMessage(browser, iconURL, messageString, buttonString,"",
- "missing-plugin", null, "top", true, buttonAccesskeyString);
-}
-
-missingPluginInstaller.prototype.observe = function(aSubject, aTopic, aData){
- switch (aTopic) {
- case "missing-plugin":
- // get the urls of missing plugins
- var tabbrowser = getBrowser();
- var missingPluginsArray = tabbrowser.mCurrentTab.missingPlugins;
-
- if (missingPluginsArray) {
- window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
- "PFSWindow", "modal,chrome,resizable=yes", {plugins: missingPluginsArray, tab: tabbrowser.mCurrentTab});
- }
-
- break;
+ const priority = notificationBox.PRIORITY_WARNING_MEDIUM;
+ const iconURL = "chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png";
+ notificationBox.appendNotification(messageString, "missing-plugins",
+ iconURL, priority, buttons);
}
}
+
+function pluginsMissing()
+{
+ // get the urls of missing plugins
+ var tabbrowser = getBrowser();
+ var missingPluginsArray = tabbrowser.mCurrentTab.missingPlugins;
+ if (missingPluginsArray) {
+ window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
+ "PFSWindow", "modal,chrome,resizable=yes", {plugins: missingPluginsArray, tab: tabbrowser.mCurrentTab});
+ }
+}
+
var gMissingPluginInstaller = new missingPluginInstaller();
function convertFromUnicode(charset, str)
diff --git a/mozilla/browser/themes/pinstripe/browser/browser.css b/mozilla/browser/themes/pinstripe/browser/browser.css
index 87a47f80f6d..3ba74ae7b87 100755
--- a/mozilla/browser/themes/pinstripe/browser/browser.css
+++ b/mozilla/browser/themes/pinstripe/browser/browser.css
@@ -878,30 +878,6 @@ tabpanels.plain {
background-color: #fff !important;
}
-browsermessage {
- background-color: #E6E6E6;
- border: 1px solid #C8C8C8;
- -moz-border-radius: 7px;
- margin: 6px;
- padding: 4px;
- font: icon;
- color: #505050;
-}
-
-.messageImage {
- margin: 0px 6px 0px 2px;
-}
-
-.messageText {
- margin: 0px 0px 0px 1px;
-}
-
-.messageButton {
- font-weight: normal;
- color: #000;
- margin: 0px 4px 0px 8px;
-}
-
#places-bookmark {
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
}
diff --git a/mozilla/toolkit/content/jar.mn b/mozilla/toolkit/content/jar.mn
index 766cb020a27..ce90964dde3 100644
--- a/mozilla/toolkit/content/jar.mn
+++ b/mozilla/toolkit/content/jar.mn
@@ -48,6 +48,7 @@ toolkit.jar:
*+ content/global/bindings/menu.xml (widgets/menu.xml)
*+ content/global/bindings/menulist.xml (widgets/menulist.xml)
*+ content/global/bindings/nativescrollbar.xml (widgets/nativescrollbar.xml)
+*+ content/global/bindings/notification.xml (widgets/notification.xml)
*+ content/global/bindings/popup.xml (widgets/popup.xml)
*+ content/global/bindings/preferences.xml (widgets/preferences.xml)
*+ content/global/bindings/progressmeter.xml (widgets/progressmeter.xml)
diff --git a/mozilla/toolkit/content/widgets/browser.xml b/mozilla/toolkit/content/widgets/browser.xml
index 6f8ec56be71..c687c130ee2 100644
--- a/mozilla/toolkit/content/widgets/browser.xml
+++ b/mozilla/toolkit/content/widgets/browser.xml
@@ -919,184 +919,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- document.getAnonymousElementByAttribute(this, "anonid", "messageImage");
-
-
-
-
-
-
-
-
-
-
-
- null;
-
-
- "";
-
-
-
- "";
-
-
-
-
-
-
-
-
-
-
-
- document.getAnonymousElementByAttribute(this, "anonid", "messageText");
-
-
- "";
-
-
-
-
-
-
-
-
-
-
-
- document.getAnonymousElementByAttribute(this, "anonid", "messageButton");
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (event.originalTarget.getAttribute("anonid") == "messageButton") {
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- var subject = this.docShell ? this.docShell : null;
- os.notifyObservers(subject, this.source, "");
- }
-
-
-
diff --git a/mozilla/toolkit/content/widgets/notification.xml b/mozilla/toolkit/content/widgets/notification.xml
new file mode 100644
index 00000000000..d552936ebaf
--- /dev/null
+++ b/mozilla/toolkit/content/widgets/notification.xml
@@ -0,0 +1,321 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+
+ null
+ 4
+
+ null
+ null
+
+
+
+ if (val)
+ this.setAttribute('notificationshidden', true);
+ else this.removeAttribute('notificationshidden');
+
+
+
+
+
+
+
+
+ = 0; n--) {
+ if (aValue == notifications[n].value)
+ return notifications[n];
+ }
+ return null;
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ this.PRIORITY_CRITICAL_BLOCK)
+ throw "Invalid notification priority " + aPriority;
+
+ // check for where the notification should be inserted according to
+ // priority. If two are equal, the existing one appears on top.
+ var notifications = this.allNotifications;
+ var insertPos = null;
+ for (n = notifications.length - 1; n >= 0; n--) {
+ if (notifications[n].priority < aPriority)
+ break;
+ insertPos = notifications[n];
+ }
+
+ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var newitem = document.createElementNS(XULNS, "notification");
+ newitem.setAttribute("label", aLabel);
+ newitem.setAttribute("value", aValue);
+ newitem.setAttribute("image", aImage);
+ this.insertBefore(newitem, insertPos);
+
+ if (aButtons) {
+ for (var b = 0; b < aButtons.length; b++) {
+ var button = aButtons[b];
+ var buttonElem = document.createElementNS(XULNS, "button");
+ buttonElem.setAttribute("label", button.label);
+ buttonElem.setAttribute("accesskey", button.accessKey);
+
+ newitem.appendChild(buttonElem);
+ buttonElem.buttonInfo = button;
+ }
+ }
+
+ newitem.priority = aPriority;
+ if (aPriority >= this.PRIORITY_CRITICAL_LOW)
+ newitem.type = "critical";
+ else if (aPriority <= this.PRIORITY_INFO_HIGH)
+ newitem.type = "info";
+ else
+ newitem.type = "warning";
+
+ // Fire event for accessibility APIs
+ var event = document.createEvent("Events");
+ event.initEvent("AlertActive", true, true);
+ this.dispatchEvent(event);
+
+ if (!insertPos)
+ this._showNotification(newitem, true);
+ return newitem;
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = 0; n--) {
+ if (aImmediate)
+ this.removeChild(notifications[n]);
+ else
+ this.removeNotification(notifications[n]);
+ }
+ this.currentNotification = null;
+ ]]>
+
+
+
+
+
+
+
+ 0 && margin + change >= 0) {
+ aNotification.style.marginTop = "0px";
+ aNotification.style.opacity = 1;
+ done = true;
+ }
+ else if (change < 0 && margin + change <= -height) {
+ aNotification.style.marginTop = -height + "px";
+ done = true;
+ }
+ else {
+ aNotification.style.marginTop = (margin + change) + "px";
+ if (opacitychange)
+ aNotification.style.opacity =
+ Number(aNotification.style.opacity) + opacitychange;
+ }
+
+ if (done) {
+ clearInterval(self._timer);
+ var newitem;
+ if (aSlideIn) {
+ newitem = aNotification;
+ }
+ else {
+ aNotification.parentNode.removeChild(aNotification);
+ var notifications = self.allNotifications;
+ var idx = notifications.length - 1;
+ if (idx >= 0)
+ newitem = notifications[idx];
+ }
+ if (newitem)
+ self.currentNotification = newitem;
+ }
+ }
+
+ this._timer = setInterval(slide, 50);
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/toolkit/content/widgets/tabbrowser.xml b/mozilla/toolkit/content/widgets/tabbrowser.xml
index 89c5b3cc287..62c54c5c90d 100644
--- a/mozilla/toolkit/content/widgets/tabbrowser.xml
+++ b/mozilla/toolkit/content/widgets/tabbrowser.xml
@@ -111,11 +111,10 @@
-
-
-
-
-
+
+
+
@@ -215,68 +214,15 @@