| 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 DocumentNatives = requireNative('document_natives'); | 5 var DocumentNatives = requireNative('document_natives'); |
| 6 var ExtensionOptionsEvents = | 6 var ExtensionOptionsEvents = |
| 7 require('extensionOptionsEvents').ExtensionOptionsEvents; | 7 require('extensionOptionsEvents').ExtensionOptionsEvents; |
| 8 var GuestView = require('guestView').GuestView; | 8 var GuestView = require('guestView').GuestView; |
| 9 var GuestViewContainer = require('guestViewContainer').GuestViewContainer; | 9 var GuestViewContainer = require('guestViewContainer').GuestViewContainer; |
| 10 var GuestViewInternal = | 10 var GuestViewInternal = |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 // TODO(ericzeng): Implement navigation to another guest view if we want | 122 // TODO(ericzeng): Implement navigation to another guest view if we want |
| 123 // that functionality. | 123 // that functionality. |
| 124 } else if (AUTO_SIZE_ATTRIBUTES.hasOwnProperty(name) > -1) { | 124 } else if (AUTO_SIZE_ATTRIBUTES.hasOwnProperty(name) > -1) { |
| 125 this[name] = newValue; | 125 this[name] = newValue; |
| 126 this.resetSizeConstraintsIfInvalid(); | 126 this.resetSizeConstraintsIfInvalid(); |
| 127 | 127 |
| 128 if (!this.guest.getId()) | 128 if (!this.guest.getId()) |
| 129 return; | 129 return; |
| 130 | 130 |
| 131 this.guest.setAutoSize({ | 131 this.guest.setSize({ |
| 132 'enableAutoSize': this.element.hasAttribute('autosize'), | 132 'enableAutoSize': this.element.hasAttribute('autosize'), |
| 133 'min': { | 133 'min': { |
| 134 'width': parseInt(this.minwidth || 0), | 134 'width': parseInt(this.minwidth || 0), |
| 135 'height': parseInt(this.minheight || 0) | 135 'height': parseInt(this.minheight || 0) |
| 136 }, | 136 }, |
| 137 'max': { | 137 'max': { |
| 138 'width': parseInt(this.maxwidth || 0), | 138 'width': parseInt(this.maxwidth || 0), |
| 139 'height': parseInt(this.maxheight || 0) | 139 'height': parseInt(this.maxheight || 0) |
| 140 } | 140 } |
| 141 }); | 141 }); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 170 this.element.style.height = newHeight + 'px'; | 170 this.element.style.height = newHeight + 'px'; |
| 171 | 171 |
| 172 // Do not allow the options page's dimensions to shrink. This ensures that the | 172 // Do not allow the options page's dimensions to shrink. This ensures that the |
| 173 // options page has a consistent UI. If the new size is larger than the | 173 // options page has a consistent UI. If the new size is larger than the |
| 174 // minimum, make that the new minimum size. | 174 // minimum, make that the new minimum size. |
| 175 if (newWidth > this.minwidth) | 175 if (newWidth > this.minwidth) |
| 176 this.minwidth = newWidth; | 176 this.minwidth = newWidth; |
| 177 if (newHeight > this.minheight) | 177 if (newHeight > this.minheight) |
| 178 this.minheight = newHeight; | 178 this.minheight = newHeight; |
| 179 | 179 |
| 180 this.guest.setAutoSize({ | 180 this.guest.setSize({ |
| 181 'enableAutoSize': this.element.hasAttribute('autosize'), | 181 'enableAutoSize': this.element.hasAttribute('autosize'), |
| 182 'min': { | 182 'min': { |
| 183 'width': parseInt(this.minwidth || 0), | 183 'width': parseInt(this.minwidth || 0), |
| 184 'height': parseInt(this.minheight || 0) | 184 'height': parseInt(this.minheight || 0) |
| 185 }, | 185 }, |
| 186 'max': { | 186 'max': { |
| 187 'width': parseInt(this.maxwidth || 0), | 187 'width': parseInt(this.maxwidth || 0), |
| 188 'height': parseInt(this.maxheight || 0) | 188 'height': parseInt(this.maxheight || 0) |
| 189 } | 189 } |
| 190 }); | 190 }); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 ExtensionOptionsImpl.prototype.resumeDeferredAutoSize = function() { | 279 ExtensionOptionsImpl.prototype.resumeDeferredAutoSize = function() { |
| 280 if (this.autosizeDeferred) { | 280 if (this.autosizeDeferred) { |
| 281 this.resize(this.deferredAutoSizeState.newWidth, | 281 this.resize(this.deferredAutoSizeState.newWidth, |
| 282 this.deferredAutoSizeState.newHeight, | 282 this.deferredAutoSizeState.newHeight, |
| 283 this.deferredAutoSizeState.oldWidth, | 283 this.deferredAutoSizeState.oldWidth, |
| 284 this.deferredAutoSizeState.oldHeight); | 284 this.deferredAutoSizeState.oldHeight); |
| 285 } | 285 } |
| 286 }; | 286 }; |
| 287 | 287 |
| 288 GuestViewContainer.registerElement(ExtensionOptionsImpl); | 288 GuestViewContainer.registerElement(ExtensionOptionsImpl); |
| OLD | NEW |