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 chrome.notifications API. |
6 | 6 |
7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
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'); |
11 | 11 |
12 function url_getter(context, key) { | 12 function url_getter(context, key) { |
13 var f = function() { | 13 var f = function() { |
14 return this[key]; | 14 return this[key]; |
15 }; | 15 }; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 lastError.set('Unable to download all specified images.'); | 112 lastError.set('Unable to download all specified images.'); |
113 failure_function(callback, id); | 113 failure_function(callback, id); |
114 }); | 114 }); |
115 }; | 115 }; |
116 } | 116 } |
117 | 117 |
118 var handleCreate = genHandle(function(callback, id) { callback(id); }); | 118 var handleCreate = genHandle(function(callback, id) { callback(id); }); |
119 var handleUpdate = genHandle(function(callback, id) { callback(false); }); | 119 var handleUpdate = genHandle(function(callback, id) { callback(false); }); |
120 | 120 |
121 var experimentalNotificationCustomHook = function(bindingsAPI, extensionId) { | 121 var notificationsCustomHook = function(bindingsAPI, extensionId) { |
122 var apiFunctions = bindingsAPI.apiFunctions; | 122 var apiFunctions = bindingsAPI.apiFunctions; |
123 apiFunctions.setHandleRequest('create', handleCreate); | 123 apiFunctions.setHandleRequest('create', handleCreate); |
124 apiFunctions.setHandleRequest('update', handleCreate); | 124 apiFunctions.setHandleRequest('update', handleCreate); |
125 }; | 125 }; |
126 | 126 |
127 chromeHidden.registerCustomHook('experimental.notification', | 127 chromeHidden.registerCustomHook('notifications', notificationsCustomHook); |
128 experimentalNotificationCustomHook); | |
OLD | NEW |