OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 var DCHECK = requireNative('logging').DCHECK; | 5 var DCHECK = requireNative('logging').DCHECK; |
6 var eventBindingsNatives = requireNative('event_bindings'); | 6 var eventBindingsNatives = requireNative('event_bindings'); |
7 var AttachEvent = eventBindingsNatives.AttachEvent; | 7 var AttachEvent = eventBindingsNatives.AttachEvent; |
8 var DetachEvent = eventBindingsNatives.DetachEvent; | 8 var DetachEvent = eventBindingsNatives.DetachEvent; |
9 var AttachFilteredEvent = eventBindingsNatives.AttachFilteredEvent; | 9 var AttachFilteredEvent = eventBindingsNatives.AttachFilteredEvent; |
10 var DetachFilteredEvent = eventBindingsNatives.DetachFilteredEvent; | 10 var DetachFilteredEvent = eventBindingsNatives.DetachFilteredEvent; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 listenerIDs = MatchAgainstEventFilter(name, filteringInfo); | 204 listenerIDs = MatchAgainstEventFilter(name, filteringInfo); |
205 | 205 |
206 var event = attachedNamedEvents[name]; | 206 var event = attachedNamedEvents[name]; |
207 if (!event) | 207 if (!event) |
208 return; | 208 return; |
209 | 209 |
210 var dispatchArgs = function(args) { | 210 var dispatchArgs = function(args) { |
211 var result = event.dispatch_(args, listenerIDs); | 211 var result = event.dispatch_(args, listenerIDs); |
212 if (result) | 212 if (result) |
213 DCHECK(!result.validationErrors, result.validationErrors); | 213 DCHECK(!result.validationErrors, result.validationErrors); |
| 214 return result; |
214 }; | 215 }; |
215 | 216 |
216 if (eventArgumentMassagers[name]) | 217 if (eventArgumentMassagers[name]) |
217 eventArgumentMassagers[name](args, dispatchArgs); | 218 eventArgumentMassagers[name](args, dispatchArgs); |
218 else | 219 else |
219 dispatchArgs(args); | 220 dispatchArgs(args); |
220 }; | 221 }; |
221 | 222 |
222 // Test if a named event has any listeners. | 223 // Test if a named event has any listeners. |
223 chromeHidden.Event.hasListener = function(name) { | 224 chromeHidden.Event.hasListener = function(name) { |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 if (event) | 465 if (event) |
465 event.detach_(); | 466 event.detach_(); |
466 } | 467 } |
467 }; | 468 }; |
468 | 469 |
469 chromeHidden.dispatchError = function(msg) { | 470 chromeHidden.dispatchError = function(msg) { |
470 console.error(msg); | 471 console.error(msg); |
471 }; | 472 }; |
472 | 473 |
473 exports.Event = chrome.Event; | 474 exports.Event = chrome.Event; |
OLD | NEW |