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 EventBindings = require('event_bindings'); |
8 | 8 |
9 var CreateEvent = function(name) { | 9 var CreateEvent = function(name) { |
10 var eventOpts = {supportsListeners: true, supportsFilters: true}; | 10 var eventOpts = {supportsListeners: true, supportsFilters: true}; |
11 return new EventBindings.Event(name, undefined, eventOpts); | 11 return new EventBindings.Event(name, undefined, eventOpts); |
12 }; | 12 }; |
13 | 13 |
14 function GuestViewEvents(view) { | 14 function GuestViewEvents(view) { |
15 this.view = view; | 15 this.view = view; |
16 this.on = {}; | 16 this.on = {}; |
17 | 17 |
18 // |setupEventProperty| is normally called automatically, but these events are | |
19 // are registered here because they are dispatched from GuestViewContainer | |
20 // instead of in response to extension events. | |
21 this.setupEventProperty('contentResize'); | |
Fady Samuel
2015/03/06 18:33:06
nit: all lowercase is expected for DOM events: con
paulmeyer
2015/03/06 18:37:09
Ah, right. Actually setupEventProperty() always co
| |
22 this.setupEventProperty('resize'); | |
18 this.setupEvents(); | 23 this.setupEvents(); |
19 } | 24 } |
20 | 25 |
21 // |GuestViewEvents.EVENTS| is a dictionary of extension events to be listened | 26 // |GuestViewEvents.EVENTS| is a dictionary of extension events to be listened |
22 // for, which specifies how each event should be handled. The events are | 27 // for, which specifies how each event should be handled. The events are |
23 // organized by name, and by default will be dispatched as DOM events with | 28 // organized by name, and by default will be dispatched as DOM events with |
24 // the same name. | 29 // the same name. |
25 // |cancelable| (default: false) specifies whether the DOM event's default | 30 // |cancelable| (default: false) specifies whether the DOM event's default |
26 // behavior can be canceled. If the default action associated with the event | 31 // behavior can be canceled. If the default action associated with the event |
27 // is prevented, then its dispatch function will return false in its event | 32 // is prevented, then its dispatch function will return false in its event |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 enumerable: true | 115 enumerable: true |
111 }); | 116 }); |
112 }; | 117 }; |
113 | 118 |
114 // Implemented by the derived event manager, if one exists. | 119 // Implemented by the derived event manager, if one exists. |
115 GuestViewEvents.prototype.getEvents = function() { return {}; }; | 120 GuestViewEvents.prototype.getEvents = function() { return {}; }; |
116 | 121 |
117 // Exports. | 122 // Exports. |
118 exports.GuestViewEvents = GuestViewEvents; | 123 exports.GuestViewEvents = GuestViewEvents; |
119 exports.CreateEvent = CreateEvent; | 124 exports.CreateEvent = CreateEvent; |
OLD | NEW |