| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EventBindings = require('event_bindings'); | 5 var EventBindings = require('event_bindings'); |
| 6 | 6 |
| 7 var CreateEvent = function(name) { | 7 var CreateEvent = function(name) { |
| 8 var eventOpts = {supportsListeners: true, supportsFilters: true}; | 8 var eventOpts = {supportsListeners: true, supportsFilters: true}; |
| 9 return new EventBindings.Event(name, undefined, eventOpts); | 9 return new EventBindings.Event(name, undefined, eventOpts); |
| 10 }; | 10 }; |
| 11 | 11 |
| 12 var EXTENSION_OPTIONS_EVENTS = { | 12 var EXTENSION_OPTIONS_EVENTS = { |
| 13 'close': { | 13 'close': { |
| 14 evt: CreateEvent('extensionOptionsInternal.onClose'), | 14 evt: CreateEvent('extensionOptionsInternal.onClose'), |
| 15 fields: [] | 15 fields: [] |
| 16 }, | 16 }, |
| 17 'load': { | 17 'load': { |
| 18 evt: CreateEvent('extensionOptionsInternal.onLoad'), | 18 evt: CreateEvent('extensionOptionsInternal.onLoad'), |
| 19 fields: [] | 19 fields: [] |
| 20 }, | 20 }, |
| 21 'sizechanged': { | 21 'sizechanged': { |
| 22 evt: CreateEvent('extensionOptionsInternal.onSizeChanged'), | 22 evt: CreateEvent('extensionOptionsInternal.onSizeChanged'), |
| 23 customHandler: function(handler, event, webViewEvent) { | 23 customHandler: function(handler, event, extensionOptionsEvent) { |
| 24 handler.handleSizeChangedEvent(event, webViewEvent); | 24 handler.handleSizeChangedEvent(event, extensionOptionsEvent); |
| 25 }, | 25 }, |
| 26 fields:['width', 'height'] | 26 fields:['newWidth', 'newHeight', 'oldWidth', 'oldHeight'] |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * @constructor | 31 * @constructor |
| 32 */ | 32 */ |
| 33 function ExtensionOptionsEvents(extensionOptionsInternal, viewInstanceId) { | 33 function ExtensionOptionsEvents(extensionOptionsInternal, viewInstanceId) { |
| 34 this.extensionOptionsInternal = extensionOptionsInternal; | 34 this.extensionOptionsInternal = extensionOptionsInternal; |
| 35 this.viewInstanceId = viewInstanceId; | 35 this.viewInstanceId = viewInstanceId; |
| 36 this.setup(); | 36 this.setup(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 self.extensionOptionsInternal.dispatchEvent(extensionOptionsEvent); | 62 self.extensionOptionsInternal.dispatchEvent(extensionOptionsEvent); |
| 63 }, {instanceId: self.viewInstanceId}); | 63 }, {instanceId: self.viewInstanceId}); |
| 64 | 64 |
| 65 this.extensionOptionsInternal.setupEventProperty(name); | 65 this.extensionOptionsInternal.setupEventProperty(name); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 ExtensionOptionsEvents.prototype.handleSizeChangedEvent = function( | 68 ExtensionOptionsEvents.prototype.handleSizeChangedEvent = function( |
| 69 event, extensionOptionsEvent) { | 69 event, extensionOptionsEvent) { |
| 70 this.extensionOptionsInternal.onSizeChanged(extensionOptionsEvent.width, | 70 this.extensionOptionsInternal.onSizeChanged(extensionOptionsEvent.newWidth, |
| 71 extensionOptionsEvent.height); | 71 extensionOptionsEvent.newHeight, |
| 72 extensionOptionsEvent.oldWidth, |
| 73 extensionOptionsEvent.oldHeight); |
| 72 this.extensionOptionsInternal.dispatchEvent(extensionOptionsEvent); | 74 this.extensionOptionsInternal.dispatchEvent(extensionOptionsEvent); |
| 73 } | 75 } |
| 74 | 76 |
| 75 exports.ExtensionOptionsEvents = ExtensionOptionsEvents; | 77 exports.ExtensionOptionsEvents = ExtensionOptionsEvents; |
| 76 exports.CreateEvent = CreateEvent; | 78 exports.CreateEvent = CreateEvent; |
| OLD | NEW |