Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: extensions/renderer/resources/web_view.js

Issue 564973004: Move ContentWindow from BrowserPlugin To GuestView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/web_view.js
diff --git a/extensions/renderer/resources/web_view.js b/extensions/renderer/resources/web_view.js
index 85c588c4071d278d553b7b4a359b24339ad41652..d28b4795cd537d227a128019e5dfe80fa5e311a0 100644
--- a/extensions/renderer/resources/web_view.js
+++ b/extensions/renderer/resources/web_view.js
@@ -94,6 +94,7 @@ function WebViewInternal(webviewNode) {
this.elementAttached = false;
this.beforeFirstNavigation = true;
+ this.contentWindow = null;
this.validPartitionId = true;
// Used to save some state upon deferred attachment.
// If <object> bindings is not available, we defer attachment.
@@ -166,6 +167,7 @@ WebViewInternal.prototype.reset = function() {
this.beforeFirstNavigation = true;
this.validPartitionId = true;
this.partition.validPartitionId = true;
+ this.contentWindow = null;
}
this.internalInstanceId = 0;
};
@@ -419,10 +421,11 @@ WebViewInternal.prototype.setupWebviewNodeProperties = function() {
// dynamic getter value.
Object.defineProperty(this.webviewNode, 'contentWindow', {
get: function() {
- if (browserPluginNode.contentWindow)
- return browserPluginNode.contentWindow;
+ if (this.contentWindow) {
+ return this.contentWindow;
+ }
window.console.error(ERROR_MSG_CONTENTWINDOW_NOT_AVAILABLE);
- },
+ }.bind(this),
// No setter.
enumerable: true
});
@@ -575,7 +578,11 @@ WebViewInternal.prototype.handleBrowserPluginAttributeMutation =
guestViewInternalNatives.AttachGuest(
this.internalInstanceId,
this.guestInstanceId,
- params);
+ params,
+ function(w) {
+ this.contentWindow = w;
+ }.bind(this)
+ );
}.bind(this), 0);
}
@@ -879,7 +886,10 @@ WebViewInternal.prototype.attachWindow = function(guestInstanceId,
return guestViewInternalNatives.AttachGuest(
this.internalInstanceId,
this.guestInstanceId,
- params);
+ params, function(w) {
+ this.contentWindow = w;
+ }.bind(this)
+ );
};
// Registers browser plugin <object> custom element.
« no previous file with comments | « extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698