OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Custom bindings for the notifications API. | 5 // Custom bindings for the notifications API. |
6 // | 6 // |
7 var binding = require('binding').Binding.create('notifications'); | 7 var binding = require('binding').Binding.create('notifications'); |
8 | 8 |
9 var sendRequest = require('sendRequest').sendRequest; | 9 var sendRequest = require('sendRequest').sendRequest; |
10 var imageUtil = require('imageUtil'); | 10 var imageUtil = require('imageUtil'); |
(...skipping 22 matching lines...) Expand all Loading... |
33 // |iconUrl| might be optional for notification updates. | 33 // |iconUrl| might be optional for notification updates. |
34 if (notificationDetails.iconUrl) { | 34 if (notificationDetails.iconUrl) { |
35 $Array.push(urlSpecs, { | 35 $Array.push(urlSpecs, { |
36 path: notificationDetails.iconUrl, | 36 path: notificationDetails.iconUrl, |
37 width: imageSizes.icon.width * imageSizes.scaleFactor, | 37 width: imageSizes.icon.width * imageSizes.scaleFactor, |
38 height: imageSizes.icon.height * imageSizes.scaleFactor, | 38 height: imageSizes.icon.height * imageSizes.scaleFactor, |
39 callback: imageDataSetter(notificationDetails, 'iconBitmap') | 39 callback: imageDataSetter(notificationDetails, 'iconBitmap') |
40 }); | 40 }); |
41 } | 41 } |
42 | 42 |
| 43 // |smallIconUrl| is optional. |
| 44 if (notificationDetails.smallIconUrl) { |
| 45 $Array.push(urlSpecs, { |
| 46 path: notificationDetails.smallIconUrl, |
| 47 width: imageSizes.smallIcon.width * imageSizes.scaleFactor, |
| 48 height: imageSizes.smallIcon.height * imageSizes.scaleFactor, |
| 49 callback: imageDataSetter(notificationDetails, 'smallIconBitmap') |
| 50 }); |
| 51 } |
| 52 |
43 // |imageUrl| is optional. | 53 // |imageUrl| is optional. |
44 if (notificationDetails.imageUrl) { | 54 if (notificationDetails.imageUrl) { |
45 $Array.push(urlSpecs, { | 55 $Array.push(urlSpecs, { |
46 path: notificationDetails.imageUrl, | 56 path: notificationDetails.imageUrl, |
47 width: imageSizes.image.width * imageSizes.scaleFactor, | 57 width: imageSizes.image.width * imageSizes.scaleFactor, |
48 height: imageSizes.image.height * imageSizes.scaleFactor, | 58 height: imageSizes.image.height * imageSizes.scaleFactor, |
49 callback: imageDataSetter(notificationDetails, 'imageBitmap') | 59 callback: imageDataSetter(notificationDetails, 'imageBitmap') |
50 }); | 60 }); |
51 } | 61 } |
52 | 62 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 136 |
127 var notificationsCustomHook = function(bindingsAPI, extensionId) { | 137 var notificationsCustomHook = function(bindingsAPI, extensionId) { |
128 var apiFunctions = bindingsAPI.apiFunctions; | 138 var apiFunctions = bindingsAPI.apiFunctions; |
129 apiFunctions.setHandleRequest('create', handleCreate); | 139 apiFunctions.setHandleRequest('create', handleCreate); |
130 apiFunctions.setHandleRequest('update', handleUpdate); | 140 apiFunctions.setHandleRequest('update', handleUpdate); |
131 }; | 141 }; |
132 | 142 |
133 binding.registerCustomHook(notificationsCustomHook); | 143 binding.registerCustomHook(notificationsCustomHook); |
134 | 144 |
135 exports.binding = binding.generate(); | 145 exports.binding = binding.generate(); |
OLD | NEW |