| 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 var binding = require('binding').Binding.create('notifications'); | 6 var binding = require('binding').Binding.create('notifications'); |
| 7 | 7 |
| 8 var sendRequest = require('sendRequest').sendRequest; | 8 var sendRequest = require('sendRequest').sendRequest; |
| 9 var imageUtil = require('imageUtil'); | 9 var imageUtil = require('imageUtil'); |
| 10 var lastError = require('lastError'); | 10 var lastError = require('lastError'); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 height: 80, | 35 height: 80, |
| 36 callback: image_data_setter(notification_details, 'iconBitmap') | 36 callback: image_data_setter(notification_details, 'iconBitmap') |
| 37 }); | 37 }); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // |imageUrl| is optional. | 40 // |imageUrl| is optional. |
| 41 if (notification_details.imageUrl) { | 41 if (notification_details.imageUrl) { |
| 42 $Array.push(url_specs, { | 42 $Array.push(url_specs, { |
| 43 path: notification_details.imageUrl, | 43 path: notification_details.imageUrl, |
| 44 width: 360, | 44 width: 360, |
| 45 height: 540, | 45 height: 240, |
| 46 callback: image_data_setter(notification_details, 'imageBitmap') | 46 callback: image_data_setter(notification_details, 'imageBitmap') |
| 47 }); | 47 }); |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Each button has an optional icon. | 50 // Each button has an optional icon. |
| 51 var button_list = notification_details.buttons; | 51 var button_list = notification_details.buttons; |
| 52 if (button_list && typeof button_list.length === 'number') { | 52 if (button_list && typeof button_list.length === 'number') { |
| 53 var num_buttons = button_list.length; | 53 var num_buttons = button_list.length; |
| 54 for (var i = 0; i < num_buttons; i++) { | 54 for (var i = 0; i < num_buttons; i++) { |
| 55 if (button_list[i].iconUrl) { | 55 if (button_list[i].iconUrl) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 var notificationsCustomHook = function(bindingsAPI, extensionId) { | 118 var notificationsCustomHook = function(bindingsAPI, extensionId) { |
| 119 var apiFunctions = bindingsAPI.apiFunctions; | 119 var apiFunctions = bindingsAPI.apiFunctions; |
| 120 apiFunctions.setHandleRequest('create', handleCreate); | 120 apiFunctions.setHandleRequest('create', handleCreate); |
| 121 apiFunctions.setHandleRequest('update', handleUpdate); | 121 apiFunctions.setHandleRequest('update', handleUpdate); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 binding.registerCustomHook(notificationsCustomHook); | 124 binding.registerCustomHook(notificationsCustomHook); |
| 125 | 125 |
| 126 exports.binding = binding.generate(); | 126 exports.binding = binding.generate(); |
| OLD | NEW |