~ps-jenkins/unity-chromium-extension/trusty-proposed

« back to all changes in this revision

Viewing changes to chromium-extension/webkitnotif-wrapper-builder.js

  • Committer: Tarmac
  • Author(s): Alexandre Abreu
  • Date: 2013-09-16 15:40:39 UTC
  • mfrom: (227.1.5 latest)
  • Revision ID: tarmac-20130916154039-oj5t4j3stjrog9sz
Release version 3.0
Remove tab integration
Keep webapps installation scheme
Keep website api injection but only handle the init() w/ a default desktop file generated to launch the webbrowser-app in chromeless mode
.

Approved by PS Jenkins bot, Robert Bruce Park.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
UnityWebappsWebkitNotificationApiPageProxyBuilder = function(backend, aWindow) {
2
 
  var PERMISSION_ALLOWED = 0;
3
 
  var PERMISSION_NOT_ALLOWED = 1;
4
 
  var PERMISSION_DENIED = 2;
5
 
  
6
 
  var nope = Function();
7
 
  var Notification = Function();
8
 
  Notification.prototype = {
9
 
    dispatchEvent: nope,
10
 
    removeEventListener: nope,
11
 
    addEventListener: nope,
12
 
    cancel: nope,
13
 
    show: nope,
14
 
    ondisplay: null,
15
 
    onerror: null,
16
 
    onclick: null,
17
 
    onclose: null,
18
 
    onshow: null,
19
 
    replaceId: '',
20
 
    dir: ''
21
 
  };
22
 
  
23
 
  aWindow.webkitNotifications.createNotification = function(iconUrl, title, body) {
24
 
    if (this.checkPermission() !== PERMISSION_ALLOWED) {
25
 
      throw new Error("not allowed");
26
 
      }
27
 
    var notification = new Notification();
28
 
    notification.show = function () {
29
 
      backend('webkitNotifications.showNotification', [iconUrl, title, body]);
30
 
    };
31
 
    return notification;
32
 
  };
33
 
};
34