| 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 // TODO(cduvall/kalman): json_schema shouldn't put things on chromeHidden. | 6 // TODO(cduvall/kalman): json_schema shouldn't put things on chromeHidden. |
| 7 require('json_schema'); | 7 require('json_schema'); |
| 8 var eventBindingsNatives = requireNative('event_bindings'); | 8 var eventBindingsNatives = requireNative('event_bindings'); |
| 9 var AttachEvent = eventBindingsNatives.AttachEvent; | 9 var AttachEvent = eventBindingsNatives.AttachEvent; |
| 10 var DetachEvent = eventBindingsNatives.DetachEvent; | 10 var DetachEvent = eventBindingsNatives.DetachEvent; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 listenerIDs = MatchAgainstEventFilter(name, filteringInfo); | 206 listenerIDs = MatchAgainstEventFilter(name, filteringInfo); |
| 207 | 207 |
| 208 var event = attachedNamedEvents[name]; | 208 var event = attachedNamedEvents[name]; |
| 209 if (!event) | 209 if (!event) |
| 210 return; | 210 return; |
| 211 | 211 |
| 212 var dispatchArgs = function(args) { | 212 var dispatchArgs = function(args) { |
| 213 var result = event.dispatch_(args, listenerIDs); | 213 var result = event.dispatch_(args, listenerIDs); |
| 214 if (result) | 214 if (result) |
| 215 DCHECK(!result.validationErrors, result.validationErrors); | 215 DCHECK(!result.validationErrors, result.validationErrors); |
| 216 return result; |
| 216 }; | 217 }; |
| 217 | 218 |
| 218 if (eventArgumentMassagers[name]) | 219 if (eventArgumentMassagers[name]) |
| 219 eventArgumentMassagers[name](args, dispatchArgs); | 220 eventArgumentMassagers[name](args, dispatchArgs); |
| 220 else | 221 else |
| 221 dispatchArgs(args); | 222 dispatchArgs(args); |
| 222 }; | 223 }; |
| 223 | 224 |
| 224 // Test if a named event has any listeners. | 225 // Test if a named event has any listeners. |
| 225 chromeHidden.Event.hasListener = function(name) { | 226 chromeHidden.Event.hasListener = function(name) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 if (event) | 467 if (event) |
| 467 event.detach_(); | 468 event.detach_(); |
| 468 } | 469 } |
| 469 }; | 470 }; |
| 470 | 471 |
| 471 chromeHidden.dispatchError = function(msg) { | 472 chromeHidden.dispatchError = function(msg) { |
| 472 console.error(msg); | 473 console.error(msg); |
| 473 }; | 474 }; |
| 474 | 475 |
| 475 chrome.Event = Event; | 476 chrome.Event = Event; |
| OLD | NEW |