Chromium Code Reviews| Index: chrome/renderer/resources/extensions/web_view.js |
| diff --git a/chrome/renderer/resources/extensions/web_view.js b/chrome/renderer/resources/extensions/web_view.js |
| index f36662b81327925ad0cb063b4a188fbae295d967..64f3b381026c54a048679736b47a028973c4babb 100644 |
| --- a/chrome/renderer/resources/extensions/web_view.js |
| +++ b/chrome/renderer/resources/extensions/web_view.js |
| @@ -106,7 +106,7 @@ function WebViewInternal(webviewNode) { |
| this.browserPluginNode = this.createBrowserPluginNode(); |
| var shadowRoot = this.webviewNode.createShadowRoot(); |
| - shadowRoot.appendChild(this.browserPluginNode); |
| + this.partition = new Partition(); |
| this.setupWebviewNodeAttributes(); |
| this.setupFocusPropagation(); |
| @@ -114,10 +114,9 @@ function WebViewInternal(webviewNode) { |
| this.viewInstanceId = IdGenerator.GetNextId(); |
| - this.partition = new Partition(); |
| - this.parseAttributes(); |
| - |
| new WebViewEvents(this, this.viewInstanceId); |
| + |
| + shadowRoot.appendChild(this.browserPluginNode); |
| } |
| /** |
| @@ -563,17 +562,20 @@ WebViewInternal.prototype.handleBrowserPluginAttributeMutation = |
| if (name == 'internalinstanceid' && !oldValue && !!newValue) { |
| this.browserPluginNode.removeAttribute('internalinstanceid'); |
| this.internalInstanceId = parseInt(newValue); |
| - if (this.deferredAttachState && !!this.guestInstanceId && |
| - this.guestInstanceId != 0) { |
| - window.setTimeout(function() { |
| - var isNewWindow = this.deferredAttachState ? |
| - this.deferredAttachState.isNewWindow : false; |
| - var params = this.buildAttachParams(isNewWindow); |
| - guestViewInternalNatives.AttachGuest( |
| - this.internalInstanceId, |
| - this.guestInstanceId, |
| - params); |
| - }.bind(this), 0); |
| + if (this.deferredAttachState) { |
| + if (!!this.guestInstanceId && this.guestInstanceId != 0) { |
| + window.setTimeout(function() { |
| + var isNewWindow = this.deferredAttachState ? |
| + this.deferredAttachState.isNewWindow : false; |
| + var params = this.buildAttachParams(isNewWindow); |
| + guestViewInternalNatives.AttachGuest( |
| + this.internalInstanceId, |
| + this.guestInstanceId, |
| + params); |
| + }.bind(this), 0); |
| + } |
| + } else { |
| + this.parseAttributes(); |
|
Fady Samuel
2014/08/25 18:55:34
Early exit preferred for readability:
if (!this.d
lazyboy
2014/08/25 19:16:44
Done.
|
| } |
| return; |
| } |
| @@ -737,6 +739,10 @@ WebViewInternal.prototype.onFrameNameChanged = function(name) { |
| } |
| }; |
| +WebViewInternal.prototype.onPluginDestroyed = function() { |
| + this.reset(); |
| +}; |
| + |
| WebViewInternal.prototype.dispatchEvent = function(webViewEvent) { |
| return this.webviewNode.dispatchEvent(webViewEvent); |
| }; |