| 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 notification API. | 5 // Custom bindings for the notifications API. |
| 6 | 6 |
| 7 var binding = require('binding').Binding.create('experimental.notification'); | 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'); |
| 11 var lastError = require('lastError'); | 11 var lastError = require('lastError'); |
| 12 var json = require('json'); | 12 var json = require('json'); |
| 13 | 13 |
| 14 function url_getter(context, key) { | 14 function url_getter(context, key) { |
| 15 var f = function() { | 15 var f = function() { |
| 16 return this[key]; | 16 return this[key]; |
| 17 }; | 17 }; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // don't know where that is. | 116 // don't know where that is. |
| 117 lastError.run('Unable to download all specified images.', | 117 lastError.run('Unable to download all specified images.', |
| 118 failure_function, [callback, id]); | 118 failure_function, [callback, id]); |
| 119 }); | 119 }); |
| 120 }; | 120 }; |
| 121 } | 121 } |
| 122 | 122 |
| 123 var handleCreate = genHandle(function(callback, id) { callback(id); }); | 123 var handleCreate = genHandle(function(callback, id) { callback(id); }); |
| 124 var handleUpdate = genHandle(function(callback, id) { callback(false); }); | 124 var handleUpdate = genHandle(function(callback, id) { callback(false); }); |
| 125 | 125 |
| 126 var experimentalNotificationCustomHook = function(bindingsAPI, extensionId) { | 126 var notificationsCustomHook = function(bindingsAPI, extensionId) { |
| 127 var apiFunctions = bindingsAPI.apiFunctions; | 127 var apiFunctions = bindingsAPI.apiFunctions; |
| 128 apiFunctions.setHandleRequest('create', handleCreate); | 128 apiFunctions.setHandleRequest('create', handleCreate); |
| 129 apiFunctions.setHandleRequest('update', handleCreate); | 129 apiFunctions.setHandleRequest('update', handleCreate); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 binding.registerCustomHook(experimentalNotificationCustomHook); | 132 binding.registerCustomHook(notificationsCustomHook); |
| 133 | 133 |
| 134 exports.binding = binding.generate(); | 134 exports.binding = binding.generate(); |
| OLD | NEW |