Bug 777517 - Webapp installation alert should launch app on click. r=myk
authorMarco Castelluccio <mar.castelluccio@studenti.unina.it>
Tue, 30 Jul 2013 18:37:00 -0700
changeset 153009 3b9baad9148559d47f4b59b7d5e52cc76ee29c4f
parent 153008 eb6f884142fcc8e71e04109bb76515b0b69ad332
child 153010 393828fbbfb161a7c6cde1f1e973693d5e5904f6
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmyk
bugs777517
milestone25.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 777517 - Webapp installation alert should launch app on click. r=myk
browser/modules/webappsUI.jsm
--- a/browser/modules/webappsUI.jsm
+++ b/browser/modules/webappsUI.jsm
@@ -109,17 +109,17 @@ this.webappsUI = {
         let app = WebappsInstaller.install(aData);
         if (app) {
           let localDir = null;
           if (app.appProfile) {
             localDir = app.appProfile.localDir;
           }
 
           DOMApplicationRegistry.confirmInstall(aData, false, localDir);
-          installationSuccessNotification(app, aWindow);
+          installationSuccessNotification(aData, app, aWindow);
         } else {
           DOMApplicationRegistry.denyInstall(aData);
         }
       }
     };
 
     let requestingURI = aWindow.makeURI(aData.from);
     let manifest = new ManifestHelper(aData.app.manifest, aData.app.origin);
@@ -135,25 +135,33 @@ this.webappsUI = {
                                             [manifest.name, host], 2);
 
     aWindow.PopupNotifications.show(aBrowser, "webapps-install", message,
                                     "webapps-notification-icon", mainAction);
 
   }
 }
 
-function installationSuccessNotification(app, aWindow) {
+function installationSuccessNotification(aData, app, aWindow) {
+  let launcher = {
+    observe: function(aSubject, aTopic) {
+      if (aTopic == "alertclickcallback") {
+        WebappOSUtils.launch(aData.app);
+      }
+    }
+  };
+
   let bundle = aWindow.gNavigatorBundle;
 
   if (("@mozilla.org/alerts-service;1" in Cc)) {
     let notifier;
     try {
       notifier = Cc["@mozilla.org/alerts-service;1"].
                  getService(Ci.nsIAlertsService);
 
       notifier.showAlertNotification(app.iconURI.spec,
                                     bundle.getString("webapps.install.success"),
                                     app.appNameAsFilename,
-                                    false, null, null);
+                                    true, null, launcher);
 
     } catch (ex) {}
   }
 }