Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/renderer/resources/extensions/notification_custom_bindings.js

Issue 12378077: Attempting to fix problems in 11571014. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 notification API.
6 6
7 var binding = require('binding').Binding.create('experimental.notification'); 7 var binding = require('binding').Binding.create('experimental.notification');
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 var notification_details = json.parse( 104 var notification_details = json.parse(
105 json.stringify(input_notification_details)); 105 json.stringify(input_notification_details));
106 var that = this; 106 var that = this;
107 replaceNotificationOptionURLs(notification_details, function(success) { 107 replaceNotificationOptionURLs(notification_details, function(success) {
108 if (success) { 108 if (success) {
109 sendRequest(that.name, 109 sendRequest(that.name,
110 [id, notification_details, callback], 110 [id, notification_details, callback],
111 that.definition.parameters); 111 that.definition.parameters);
112 return; 112 return;
113 } 113 }
114 lastError.set('Unable to download all specified images.'); 114 // TODO(kalman): This is probably wrong, failure_function is created in
115 failure_function(callback, id); 115 // this context but it should be created in the caller's context. I just
116 // don't know where that is.
117 lastError.run('Unable to download all specified images.',
118 failure_function);
116 }); 119 });
117 }; 120 };
118 } 121 }
119 122
120 var handleCreate = genHandle(function(callback, id) { callback(id); }); 123 var handleCreate = genHandle(function(callback, id) { callback(id); });
121 var handleUpdate = genHandle(function(callback, id) { callback(false); }); 124 var handleUpdate = genHandle(function(callback, id) { callback(false); });
122 125
123 var experimentalNotificationCustomHook = function(bindingsAPI, extensionId) { 126 var experimentalNotificationCustomHook = function(bindingsAPI, extensionId) {
124 var apiFunctions = bindingsAPI.apiFunctions; 127 var apiFunctions = bindingsAPI.apiFunctions;
125 apiFunctions.setHandleRequest('create', handleCreate); 128 apiFunctions.setHandleRequest('create', handleCreate);
126 apiFunctions.setHandleRequest('update', handleCreate); 129 apiFunctions.setHandleRequest('update', handleCreate);
127 }; 130 };
128 131
129 binding.registerCustomHook(experimentalNotificationCustomHook); 132 binding.registerCustomHook(experimentalNotificationCustomHook);
130 133
131 exports.binding = binding.generate(); 134 exports.binding = binding.generate();
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/miscellaneous_bindings.js ('k') | chrome/renderer/resources/extensions/send_request.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698