hterm: initial support for custom notifications

First refactor the existing bell notification code to expose
a simple API for callers.  This creates hterm.notify and some
core tests.

We support iTerm2's simple growl notifications (OSC 9), and
rxvt-unicode's notify module (OSC 777) for title/body.

BUG=chromium:735780

Change-Id: Ie704634938fe9966fb1adbca9035fd7d6bd15acf
Reviewed-on: https://chromium-review.googlesource.com/551336
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/hterm/js/hterm_terminal.js b/hterm/js/hterm_terminal.js
index 7a75e7a..aa31ce2 100644
--- a/hterm/js/hterm_terminal.js
+++ b/hterm/js/hterm_terminal.js
@@ -2388,9 +2388,7 @@
   }
 
   if (this.desktopNotificationBell_ && !this.document_.hasFocus()) {
-    var n = new Notification(
-        lib.f.replaceVars(hterm.desktopNotificationTitle,
-                          {'title': window.document.title || 'hterm'}));
+    var n = hterm.notify();
     this.bellNotificationList_.push(n);
     // TODO: Should we try to raise the window here?
     n.onclick = function() { self.closeBellNotifications_(); };