| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var messagePort = null; | 5 var messagePort = null; |
| 6 | 6 |
| 7 addEventListener('message', function(event) { | 7 addEventListener('message', function(event) { |
| 8 messagePort = event.data; | 8 messagePort = event.data; |
| 9 messagePort.postMessage('ready'); | 9 messagePort.postMessage('ready'); |
| 10 }); | 10 }); |
| 11 | 11 |
| 12 addEventListener('notificationclick', function(event) { | 12 addEventListener('notificationclick', function(event) { |
| 13 if (event.notification.data === 'ACTION_CREATE_TAB') | 13 if (event.notification.data === 'ACTION_CREATE_TAB') |
| 14 clients.openWindow('https://chrome.com/'); | 14 clients.openWindow('https://chrome.com/'); |
| 15 else if (event.notification.data === 'ACTION_REPLY') |
| 16 messagePort.postMessage('reply: ' + event.reply) |
| 15 | 17 |
| 16 event.notification.close(); | 18 event.notification.close(); |
| 17 }); | 19 }); |
| OLD | NEW |