| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // Event management for GuestViewContainers. | 5 // Event management for GuestViewContainers. |
| 6 | 6 |
| 7 var EventBindings = require('event_bindings'); |
| 7 var GuestViewInternalNatives = requireNative('guest_view_internal'); | 8 var GuestViewInternalNatives = requireNative('guest_view_internal'); |
| 8 var MessagingNatives = requireNative('messaging_natives'); | 9 var MessagingNatives = requireNative('messaging_natives'); |
| 9 | 10 |
| 10 var jsEvent; | 11 var EventBindings; |
| 11 var CreateEvent = function(name) { | 12 var CreateEvent = function(name) { |
| 13 var eventOpts = {supportsListeners: true, supportsFilters: true}; |
| 12 if (bindingUtil) | 14 if (bindingUtil) |
| 13 return bindingUtil.createCustomEvent(name, undefined, undefined); | 15 return bindingUtil.createCustomEvent(name, null, eventOpts); |
| 14 if (!jsEvent) | 16 if (!EventBindings) |
| 15 jsEvent = require('event_bindings').Event; | 17 EventBindings = require('event_bindings'); |
| 16 return new jsEvent(name, undefined, {unmanaged: true}); | 18 return new EventBindings.Event(name, undefined, eventOpts); |
| 17 }; | 19 }; |
| 18 | 20 |
| 19 function GuestViewEvents(view) { | 21 function GuestViewEvents(view) { |
| 20 view.events = this; | 22 view.events = this; |
| 21 | 23 |
| 22 this.view = view; | 24 this.view = view; |
| 23 this.on = {}; | 25 this.on = {}; |
| 24 | 26 |
| 25 // |setupEventProperty| is normally called automatically, but these events are | 27 // |setupEventProperty| is normally called automatically, but these events are |
| 26 // are registered here because they are dispatched from GuestViewContainer | 28 // are registered here because they are dispatched from GuestViewContainer |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return $Function.apply(func, view.events, $Array.slice(arguments)); | 180 return $Function.apply(func, view.events, $Array.slice(arguments)); |
| 179 }; | 181 }; |
| 180 }; | 182 }; |
| 181 | 183 |
| 182 // Implemented by the derived event manager, if one exists. | 184 // Implemented by the derived event manager, if one exists. |
| 183 GuestViewEvents.prototype.getEvents = function() { return {}; }; | 185 GuestViewEvents.prototype.getEvents = function() { return {}; }; |
| 184 | 186 |
| 185 // Exports. | 187 // Exports. |
| 186 exports.$set('GuestViewEvents', GuestViewEvents); | 188 exports.$set('GuestViewEvents', GuestViewEvents); |
| 187 exports.$set('CreateEvent', CreateEvent); | 189 exports.$set('CreateEvent', CreateEvent); |
| OLD | NEW |