Bug 1227300, Part 5 - Implement showAlert for the B2G alerts backend. r=mhenretty

--HG--
extra : commitid : JMm9N0eVUYr
extra : rebase_source : dfb08f757919cb1345f4447e88c7ad91a70194e3
This commit is contained in:
Kit Cambridge 2015-11-23 15:01:57 -08:00
parent 91f6d2449c
commit a96af10ef8

View File

@ -66,23 +66,36 @@ AlertsService.prototype = {
},
// nsIAlertsService
showAlert: function(aAlert, aAlertListener) {
if (!aAlert) {
return;
}
cpmm.sendAsyncMessage(kMessageAlertNotificationSend, {
imageURL: aAlert.imageURL,
title: aAlert.title,
text: aAlert.text,
clickable: aAlert.textClickable,
cookie: aAlert.cookie,
listener: aAlertListener,
id: aAlert.name,
dir: aAlert.dir,
lang: aAlert.lang,
dataStr: aAlert.data,
inPrivateBrowsing: aAlert.inPrivateBrowsing
});
},
showAlertNotification: function(aImageUrl, aTitle, aText, aTextClickable,
aCookie, aAlertListener, aName, aBidi,
aLang, aDataStr, aPrincipal,
aInPrivateBrowsing) {
cpmm.sendAsyncMessage(kMessageAlertNotificationSend, {
imageURL: aImageUrl,
title: aTitle,
text: aText,
clickable: aTextClickable,
cookie: aCookie,
listener: aAlertListener,
id: aName,
dir: aBidi,
lang: aLang,
dataStr: aDataStr,
inPrivateBrowsing: aInPrivateBrowsing
});
let alert = Cc["@mozilla.org/alert-notification;1"].
createInstance(Ci.nsIAlertNotification);
alert.init(aName, aImageUrl, aTitle, aText, aTextClickable, aCookie,
aBidi, aLang, aDataStr, aPrincipal, aInPrivateBrowsing);
this.showAlert(alert, aAlertListener);
},
closeAlert: function(aName) {