Bug 1224521 - Replace all toasts created from within browser.js with snackbars. r=mcomella

--HG--
extra : commitid : IfNvz8chSGo
extra : rebase_source : cd5cce4a7d262b05419f0bfaa9f39c43691a7f56
This commit is contained in:
Sebastian Kaspari 2015-11-18 08:51:37 +01:00
parent f4d460bfbb
commit eb77709b3a

View File

@ -459,7 +459,7 @@ var BrowserApp = {
Messaging.addListener(this.getHistory.bind(this), "Session:GetHistory");
function showFullScreenWarning() {
NativeWindow.toast.show(Strings.browser.GetStringFromName("alertFullScreenToast"), "short");
Snackbars.show(Strings.browser.GetStringFromName("alertFullScreenToast"), Snackbars.LENGTH_SHORT);
}
window.addEventListener("fullscreen", function() {
@ -1267,7 +1267,7 @@ var BrowserApp = {
// Calling this will update the state in BrowserApp after a tab has been
// closed in the Java UI.
_handleTabClosed: function _handleTabClosed(aTab, aShowUndoToast) {
_handleTabClosed: function _handleTabClosed(aTab, aShowUndoSnackbar) {
if (aTab == this.selectedTab)
this.selectedTab = null;
@ -1277,8 +1277,8 @@ var BrowserApp = {
evt.initUIEvent("TabClose", true, false, window, tabIndex);
aTab.browser.dispatchEvent(evt);
if (aShowUndoToast) {
// Get a title for the undo close toast. Fall back to the URL if there is no title.
if (aShowUndoSnackbar) {
// Get a title for the undo close snackbar. Fall back to the URL if there is no title.
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let closedTabData = ss.getClosedTabs(window)[0];
@ -3085,7 +3085,7 @@ var NativeWindow = {
_copyStringToDefaultClipboard: function(aString) {
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
clipboard.copyString(aString);
NativeWindow.toast.show(Strings.browser.GetStringFromName("selectionHelper.textCopied"), "short");
Snackbars.show(Strings.browser.GetStringFromName("selectionHelper.textCopied"), Snackbars.LENGTH_SHORT);
},
_stripScheme: function(aString) {
@ -5877,7 +5877,7 @@ var XPInstallObserver = {
switch (aTopic) {
case "addon-install-started":
NativeWindow.toast.show(strings.GetStringFromName("alertAddonsDownloading"), "short");
Snackbars.show(strings.GetStringFromName("alertAddonsDownloading"), Snackbars.LENGTH_SHORT);
break;
case "addon-install-disabled": {
if (!tab)
@ -6920,7 +6920,7 @@ var SearchEngines = {
Services.search.addEngine(engine.url, Ci.nsISearchEngine.DATA_XML, engine.iconURL, false, {
onSuccess: function() {
// Display a toast confirming addition of new search engine.
NativeWindow.toast.show(Strings.browser.formatStringFromName("alertSearchEngineAddedToast", [engine.title], 1), "long");
Snackbars.show(Strings.browser.formatStringFromName("alertSearchEngineAddedToast", [engine.title], 1), Snackbars.LENGTH_SHORT);
},
onError: function(aCode) {
@ -6934,7 +6934,7 @@ var SearchEngines = {
errorMessage = "alertSearchEngineErrorToast";
}
NativeWindow.toast.show(Strings.browser.formatStringFromName(errorMessage, [engine.title], 1), "long");
Snackbars.show(Strings.browser.formatStringFromName(errorMessage, [engine.title], 1), Snackbars.LENGTH_SHORT);
}
});
},
@ -7015,7 +7015,7 @@ var SearchEngines = {
name = title.value + " " + i;
Services.search.addEngineWithDetails(name, favicon, null, null, method, formURL);
NativeWindow.toast.show(Strings.browser.formatStringFromName("alertSearchEngineAddedToast", [name], 1), "long");
Snackbars.show(Strings.browser.formatStringFromName("alertSearchEngineAddedToast", [name], 1), Snackbars.LENGTH_SHORT);
let engine = Services.search.getEngineByName(name);
engine.wrappedJSObject._queryCharset = charset;
for (let i = 0; i < formData.length; ++i) {