Chromium Code Reviews| Index: chrome/renderer/resources/extensions/extension_options.js |
| diff --git a/chrome/renderer/resources/extensions/extension_options.js b/chrome/renderer/resources/extensions/extension_options.js |
| index d88c3d1460a5bd490e6ba0ba423f1c3f03bf0863..9dc1e69ecdb87ec2303ccf7db8fe5fad6fedc117 100644 |
| --- a/chrome/renderer/resources/extensions/extension_options.js |
| +++ b/chrome/renderer/resources/extensions/extension_options.js |
| @@ -134,9 +134,39 @@ ExtensionOptionsInternal.prototype.init = function() { |
| this.createGuest(); |
| }; |
| -ExtensionOptionsInternal.prototype.onSizeChanged = function(width, height) { |
| - this.browserPluginNode.style.width = width + 'px'; |
| - this.browserPluginNode.style.height = height + 'px'; |
| +ExtensionOptionsInternal.prototype.onSizeChanged = |
| + function(newWidth, newHeight, oldWidth, oldHeight) { |
| + // When this method is called, the sizechanged event on the external |
| + // ExtensionOptions object is fired at the same time. This timeout allows |
| + // the embedder WebUI overlay to perform resizing animations before the |
| + // guest view resizes. |
| + var animationTime = 0.25 * Math.sqrt( |
|
not at google - send to devlin
2014/08/19 17:02:48
Why is there animation code inside the extension_o
ericzeng
2014/08/19 18:20:13
I need a way to delay <extensionoptions> from auto
not at google - send to devlin
2014/08/19 19:27:18
Ah I see. It's still unfortunately specific to be
|
| + Math.pow(newWidth - oldWidth, 2) + |
| + Math.pow(newHeight - oldHeight, 2)); |
| + setTimeout(function() { |
| + this.browserPluginNode.style.width = newWidth + 'px'; |
| + this.browserPluginNode.style.height = newHeight + 'px'; |
| + |
| + // Do not allow the options page's dimensions to shrink so that the options |
| + // page has a consistent UI. If the new size is larger than the minimum, |
| + // make that the new minimum size. |
| + if (newWidth > this.minwidth) |
| + this.minwidth = newWidth; |
| + if (newHeight > this.minheight) |
| + this.minheight = newHeight; |
| + |
| + GuestViewInternal.setAutoSize(this.instanceId, { |
| + 'enableAutoSize': this.extensionoptionsNode.hasAttribute('autosize'), |
| + 'min': { |
| + 'width': parseInt(this.minwidth || 0), |
| + 'height': parseInt(this.minheight || 0) |
| + }, |
| + 'max': { |
| + 'width': parseInt(this.maxwidth || 0), |
| + 'height': parseInt(this.maxheight || 0) |
| + } |
| + }); |
| + }.bind(this), animationTime); |
| }; |
| ExtensionOptionsInternal.prototype.parseExtensionAttribute = function() { |