Notifications progress

I’ve made some progress since my last post:

screenshot of early-stage new geolocation notification UI

Still rather ugly, but at least it’s functional!

Some things I’ll be looking into next:

  • the dismissal behavior – currently dismissing the notification (i.e. clicking elsewhere on the screen) denies the geolocation request. I think we want to instead keep the request pending and allow you to access it later from the site-identity menu, but that requires some extra work (tracking shown/unshown notifications, etc.)
  • make notifications triggered from background tabs/windows behave correctly (right now they’re just ignored)
  • multiple-notification stacking
  • support for different priorities (not sure this will be needed)
  • styling! – Stephen is working on mockups for menu-buttons, which is probably the most obvious issue

The current working API is very similar to the existing notificationbox API. It’s definitely not set in stone. Right now it looks like this:

var mainAction = {
  label: "Share Location",
  accessKey: "S",
  callback: function() {
    request.allow();
  },
};

var secondaryActions = [
  {
    label: "Always Share",
    accessKey: "A",
    callback: function () {
      Services.perms.add(requestingURI, "geo", ALLOW_ACTION);
      request.allow();
    }
  },
  {
    label: "Never Share",
    accessKey: "N",
    callback: function () {
      Services.perms.add(requestingURI, "geo", DENY_ACTION);
      request.cancel();
    }
  }
];

var dismissalAction = {
  callback: function() {
    request.cancel();
  }
};

Notification.show("geolocation", "title", message,
                  "chrome://browser/skin/Geo.png",
                  mainAction, secondaryActions,
                  dismissalAction, browser);

6 thoughts on “Notifications progress

  1. Pingback: Theme Status (Timelines, Panels and Progress) « Chromatic Pixel

  2. Pingback: BattleIT » Artiklid » Piilume kardinate taha – Mozilla Firefox 4

  3. Pingback: Gavin’s blog » mise a jour

Comments are closed.