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

Unified Diff: extensions/renderer/resources/guest_view/guest_view_container.js

Issue 845363004: <webview>, <appview> and <extensionoptions> can run in a detached state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SurfaceView fix Created 5 years, 11 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
Index: extensions/renderer/resources/guest_view/guest_view_container.js
diff --git a/extensions/renderer/resources/guest_view/guest_view_container.js b/extensions/renderer/resources/guest_view/guest_view_container.js
index c53a34423eb0f8ef82283bed341982ffb83f44e8..9fa4ff7262f21a3ebd0ec8845525513676fb7196 100644
--- a/extensions/renderer/resources/guest_view/guest_view_container.js
+++ b/extensions/renderer/resources/guest_view/guest_view_container.js
@@ -81,22 +81,14 @@ GuestViewContainer.prototype.setupFocusPropagation = function() {
}.bind(this));
};
-GuestViewContainer.prototype.attach = function() {
- // Augment the attach parameters with the element size, so that the guestview
- // can fit the element initially.
- var attachParams = this.buildAttachParams();
- attachParams['elementWidth'] = parseInt(this.element.offsetWidth);
- attachParams['elementHeight'] = parseInt(this.element.offsetHeight);
-
- this.guest.attach(this.internalInstanceId, this.viewInstanceId, attachParams);
-};
-
GuestViewContainer.prototype.attachWindow = function() {
if (!this.internalInstanceId) {
return true;
}
- this.attach();
+ this.guest.attach(this.internalInstanceId,
+ this.viewInstanceId,
+ this.buildParams());
return true;
};
@@ -109,12 +101,22 @@ GuestViewContainer.prototype.handleBrowserPluginAttributeMutation =
if (!this.guest.getId()) {
return;
}
- this.attach();
+ this.guest.attach(this.internalInstanceId,
+ this.viewInstanceId,
+ this.buildParams());
}
};
+GuestViewContainer.prototype.buildParams = function() {
+ var params = this.buildContainerParams();
+ params['instanceId'] = this.viewInstanceId;
+ params['elementWidth'] = parseInt(this.element.offsetWidth);
+ params['elementHeight'] = parseInt(this.element.offsetHeight);
+ return params;
+};
+
// Implemented by the specific view type, if needed.
-GuestViewContainer.prototype.buildAttachParams = function() { return {}; };
+GuestViewContainer.prototype.buildContainerParams = function() { return {}; };
GuestViewContainer.prototype.handleAttributeMutation = function() {};
GuestViewContainer.prototype.onElementAttached = function() {};
GuestViewContainer.prototype.onElementDetached = function() {
@@ -189,6 +191,7 @@ function registerGuestViewElement(guestViewContainerType) {
return;
}
internal.elementAttached = false;
+ internal.internalInstanceId = 0;
internal.onElementDetached();
};

Powered by Google App Engine
This is Rietveld 408576698