diff options
author | paulmeyer <paulmeyer@chromium.org> | 2014-12-04 12:15:42 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-04 20:17:02 +0000 |
commit | 37f21840a18c84d79d03cc0021a17bbccb6a054e (patch) | |
tree | af05aa78a5fdd4e4320980197c5ae1d62706ad7e /chrome/renderer | |
parent | 55bf55e89e6b26e55fd0dc54525c37acf452d41e (diff) | |
download | chromium_src-37f21840a18c84d79d03cc0021a17bbccb6a054e.zip chromium_src-37f21840a18c84d79d03cc0021a17bbccb6a054e.tar.gz chromium_src-37f21840a18c84d79d03cc0021a17bbccb6a054e.tar.bz2 |
Moved more shared functionality out of webview/appview/extensionoptions into GuestViewContainer.
**********
- Moved all the functions that work with the browserplugin into GuestViewContainer.
- Moved all references to |browserPluginElement| into GuestViewContainer, and made it private because it does not need to be accessed by specific views anymore.
- Some other shared code moved out as well.
BUG=431002, 434226
Review URL: https://codereview.chromium.org/777903002
Cr-Commit-Position: refs/heads/master@{#306877}
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/resources/extensions/extension_options.js | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/chrome/renderer/resources/extensions/extension_options.js b/chrome/renderer/resources/extensions/extension_options.js index e0ae072..f81e76c 100644 --- a/chrome/renderer/resources/extensions/extension_options.js +++ b/chrome/renderer/resources/extensions/extension_options.js @@ -22,11 +22,7 @@ var AUTO_SIZE_ATTRIBUTES = { }; function ExtensionOptionsImpl(extensionoptionsElement) { - GuestViewContainer.call(this, extensionoptionsElement) - - this.guest = new GuestView('extensionoptions'); - this.viewInstanceId = IdGenerator.GetNextId(); - this.autosizeDeferred = false; + GuestViewContainer.call(this, extensionoptionsElement, 'extensionoptions'); // on* Event handlers. this.eventHandlers = {}; @@ -38,13 +34,10 @@ function ExtensionOptionsImpl(extensionoptionsElement) { this.setupEventProperty('createfailed'); new ExtensionOptionsEvents(this, this.viewInstanceId); + this.autosizeDeferred = false; + this.setupElementProperties(); this.parseExtensionAttribute(); - - // Once the browser plugin has been created, the guest view will be created - // and attached. See handleBrowserPluginAttributeMutation(). - var shadowRoot = this.element.createShadowRoot(); - shadowRoot.appendChild(this.browserPluginElement); }; ExtensionOptionsImpl.prototype.__proto__ = GuestViewContainer.prototype; @@ -83,15 +76,6 @@ ExtensionOptionsImpl.prototype.buildAttachParams = function() { return params; }; -ExtensionOptionsImpl.prototype.attachWindow = function() { - if (!this.internalInstanceId) { - return true; - } - - this.guest.attach(this.internalInstanceId, this.buildAttachParams()); - return true; -}; - ExtensionOptionsImpl.prototype.createGuest = function() { if (!this.elementAttached) { return; @@ -163,18 +147,6 @@ ExtensionOptionsImpl.prototype.handleAttributeMutation = } }; -ExtensionOptionsImpl.prototype.handleBrowserPluginAttributeMutation = - function(name, oldValue, newValue) { - if (name == 'internalinstanceid' && !oldValue && !!newValue) { - this.internalInstanceId = parseInt(newValue); - this.browserPluginElement.removeAttribute('internalinstanceid'); - if (!this.guest.getId() || !this.extensionId) { - return; - } - this.attachWindow(); - } -}; - ExtensionOptionsImpl.prototype.onSizeChanged = function(newWidth, newHeight, oldWidth, oldHeight) { if (this.autosizeDeferred) { @@ -199,12 +171,12 @@ ExtensionOptionsImpl.prototype.parseExtensionAttribute = function() { ExtensionOptionsImpl.prototype.resize = function(newWidth, newHeight, oldWidth, oldHeight) { - this.browserPluginElement.style.width = newWidth + 'px'; - this.browserPluginElement.style.height = newHeight + 'px'; + this.element.style.width = newWidth + 'px'; + this.element.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. + // Do not allow the options page's dimensions to shrink. This ensures 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) |