Bug 932830 - Add an "onshown" option to Home.banner options. r=wesj
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Mon, 04 Nov 2013 14:39:00 -0800
changeset 153503 c7bf717e72b1e1918018d55d4566af42077dae9d
parent 153502 c90796281722b4e07c4161c0ed59616bd324b822
child 153504 b0bce439c6e2e64225d7add4954e2983bd0d57ab
push id35816
push userkwierso@gmail.com
push dateTue, 05 Nov 2013 05:22:53 +0000
treeherdermozilla-inbound@442b47e9fb80 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs932830
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 932830 - Add an "onshown" option to Home.banner options. r=wesj
mobile/android/modules/Home.jsm
--- a/mobile/android/modules/Home.jsm
+++ b/mobile/android/modules/Home.jsm
@@ -35,16 +35,19 @@ function BannerMessage(options) {
   this.id = uuidgen.generateUUID().toString();
 
   if ("text" in options && options.text != null)
     this.text = options.text;
 
   if ("icon" in options && options.icon != null)
     this.iconURI = resolveGeckoURI(options.icon);
 
+  if ("onshown" in options && typeof options.onshown === "function")
+    this.onshown = options.onshown;
+
   if ("onclick" in options && typeof options.onclick === "function")
     this.onclick = options.onclick;
 }
 
 let HomeBanner = {
   // Holds the messages that will rotate through the banner.
   _messages: {},
 
@@ -71,16 +74,19 @@ let HomeBanner = {
 
     let message = this._messages[id];
     sendMessageToJava({
       type: "HomeBanner:Data",
       id: message.id,
       text: message.text,
       iconURI: message.iconURI
     });
+
+    if (message.onshown)
+      message.onshown();
   },
 
   _handleClick: function(id) {
     let message = this._messages[id];
     if (message.onclick)
       message.onclick();
   },