Bug 569402 - Show notifications in the Status Bar on Android r=blassey a=blocking-fennec
authorAlex Pakhotin <alexp@mozilla.com>
Tue, 15 Jun 2010 17:26:05 -0700
changeset 66515 222eb8ef2cab559a056e1ff878940d6f312792cc
parent 66514 2e5294ed605b658c4191e763a526a5905cf770d5
child 66516 e0d6446775a29969a0c0e5bfa4844d78af8312cb
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, blocking-fennec
bugs569402
Bug 569402 - Show notifications in the Status Bar on Android r=blassey a=blocking-fennec
mobile/chrome/content/downloads.js
mobile/chrome/content/extensions.js
mobile/chrome/jar.mn
mobile/components/Makefile.in
--- a/mobile/chrome/content/downloads.js
+++ b/mobile/chrome/content/downloads.js
@@ -32,17 +32,21 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
 
+#ifdef ANDROID
+const URI_GENERIC_ICON_DOWNLOAD = "drawable://alertdownloads";
+#else
 const URI_GENERIC_ICON_DOWNLOAD = "chrome://browser/skin/images/alert-downloads-30.png";
+#endif
 
 var DownloadsView = {
   _initialized: false,
   _list: null,
   _dlmgr: null,
   _progress: null,
 
   _initStatement: function dv__initStatement() {
@@ -417,28 +421,30 @@ var DownloadsView = {
         return;
 
       let download = aSubject.QueryInterface(Ci.nsIDownload);
       let strings = Elements.browserBundle;
       var notifier = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
 
       if (aTopic == "dl-start") {
         notifier.showAlertNotification(URI_GENERIC_ICON_DOWNLOAD, strings.getString("alertDownloads"),
-                                       strings.getFormattedString("alertDownloadsStart", [download.displayName]), false, "", null);
+                                       strings.getFormattedString("alertDownloadsStart", [download.displayName]), false, "", null,
+                                       download.target.spec.replace("file:", "download:"));
       }
       else {
         let observer = {
           observe: function (aSubject, aTopic, aData) {
             if (aTopic == "alertclickcallback")
               BrowserUI.showPanel("downloads-container");
           }
         };
 
         notifier.showAlertNotification(URI_GENERIC_ICON_DOWNLOAD, strings.getString("alertDownloads"),
-                                       strings.getFormattedString("alertDownloadsDone", [download.displayName]), true, "", observer);
+                                       strings.getFormattedString("alertDownloadsDone", [download.displayName]), true, "", observer,
+                                       download.target.spec.replace("file:", "download:"));
       }
     }
   },
 
   QueryInterface: function (aIID) {
     if (!aIID.equals(Ci.nsIObserver) &&
         !aIID.equals(Ci.nsISupportsWeakReference) &&
         !aIID.equals(Ci.nsISupports))
--- a/mobile/chrome/content/extensions.js
+++ b/mobile/chrome/content/extensions.js
@@ -35,17 +35,21 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 const PREFIX_ITEM_URI = "urn:mozilla:item:";
 const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#";
 
 const PREF_GETADDONS_MAXRESULTS = "extensions.getAddons.maxResults";
 
+#ifdef ANDROID
+const URI_GENERIC_ICON_XPINSTALL = "drawable://alertaddons";
+#else
 const URI_GENERIC_ICON_XPINSTALL = "chrome://browser/skin/images/alert-addons-30.png";
+#endif
 
 XPCOMUtils.defineLazyGetter(this, "AddonManager", function() {
   Cu.import("resource://gre/modules/AddonManager.jsm");
   return AddonManager;
 });
 
 XPCOMUtils.defineLazyGetter(this, "AddonRepository", function() {
   Cu.import("resource://gre/modules/AddonRepository.jsm");
@@ -779,11 +783,11 @@ AddonInstallListener.prototype = {
       observe: function (aSubject, aTopic, aData) {
         if (aTopic == "alertclickcallback")
           BrowserUI.showPanel("addons-container");
       }
     };
 
     let alerts = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
     alerts.showAlertNotification(URI_GENERIC_ICON_XPINSTALL, strings.getString("alertAddons"),
-                                 message, true, "", observer);
+                                 message, true, "", observer, "addons");
   }
 };
--- a/mobile/chrome/jar.mn
+++ b/mobile/chrome/jar.mn
@@ -41,18 +41,18 @@ chrome.jar:
   content/sanitize.js                  (content/sanitize.js)
 * content/BrowserView.js               (content/BrowserView.js)
   content/TileManager.js               (TileManager.js)
 * content/InputHandler.js              (content/InputHandler.js)
 * content/Util.js                      (content/Util.js)
   content/forms.js                     (content/forms.js)
 * content/preferences.js               (content/preferences.js)
   content/exceptions.js                (content/exceptions.js)
-  content/extensions.js                (content/extensions.js)
-  content/downloads.js                 (content/downloads.js)
+* content/extensions.js                (content/extensions.js)
+* content/downloads.js                 (content/downloads.js)
   content/console.js                   (content/console.js)
   content/prompt/alert.xul             (content/prompt/alert.xul)
   content/prompt/confirm.xul           (content/prompt/confirm.xul)
   content/prompt/prompt.xul            (content/prompt/prompt.xul)
   content/prompt/promptPassword.xul    (content/prompt/promptPassword.xul)
   content/prompt/select.xul            (content/prompt/select.xul)
   content/prompt/prompt.js             (content/prompt/prompt.js)
   content/share.xul                    (content/share.xul)
--- a/mobile/components/Makefile.in
+++ b/mobile/components/Makefile.in
@@ -56,25 +56,28 @@ EXTRA_PP_COMPONENTS = \
         Sidebar.js \
         SessionStore.js \
         $(NULL)
 
 EXTRA_COMPONENTS = \
         MobileComponents.manifest \
         BrowserStartup.js \
         GeolocationPrompt.js \
-        AlertsService.js \
         XPIDialogService.js \
         DownloadManagerUI.js \
         HelperAppDialog.js \
         PromptService.js \
         BrowserCLH.js \
         ContentDispatchChooser.js \
         AutoCompleteCache.js \
         AddonUpdateService.js \
         FormAutoComplete.js \
         LoginManager.js \
 	$(NULL)
 
+ifndef ANDROID
+EXTRA_COMPONENTS += AlertsService.js
+endif
+
 DIRS =  phone \
         $(NULL)
 
 include $(topsrcdir)/config/rules.mk