| 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 ebcc3136b5e56a3b0bb67996f3da111ab60ebb61..cee4d6dd50148e21e51b995482aa14ac2914beb2 100644
|
| --- a/extensions/renderer/resources/guest_view/guest_view_container.js
|
| +++ b/extensions/renderer/resources/guest_view/guest_view_container.js
|
| @@ -22,10 +22,10 @@ function GuestViewContainer(element, viewType) {
|
| this.guest = new GuestView(viewType);
|
| this.setupAttributes();
|
|
|
| - privates(this).browserPluginElement = this.createBrowserPluginElement();
|
| + privates(this).internalElement = this.createInternalElement$();
|
| this.setupFocusPropagation();
|
| var shadowRoot = this.element.createShadowRoot();
|
| - shadowRoot.appendChild(privates(this).browserPluginElement);
|
| + shadowRoot.appendChild(privates(this).internalElement);
|
|
|
| GuestViewInternalNatives.RegisterView(this.viewInstanceId, this);
|
| }
|
| @@ -84,7 +84,7 @@ GuestViewContainer.prototype.setupGuestProperty = function() {
|
| });
|
| };
|
|
|
| -GuestViewContainer.prototype.createBrowserPluginElement = function() {
|
| +GuestViewContainer.prototype.createInternalElement$ = function() {
|
| // We create BrowserPlugin as a custom element in order to observe changes
|
| // to attributes synchronously.
|
| var browserPluginElement =
|
| @@ -103,15 +103,15 @@ GuestViewContainer.prototype.setupFocusPropagation = function() {
|
| }
|
| this.element.addEventListener('focus', this.weakWrapper(function(e) {
|
| // Focus the BrowserPlugin when the GuestViewContainer takes focus.
|
| - privates(this).browserPluginElement.focus();
|
| + privates(this).internalElement.focus();
|
| }));
|
| this.element.addEventListener('blur', this.weakWrapper(function(e) {
|
| // Blur the BrowserPlugin when the GuestViewContainer loses focus.
|
| - privates(this).browserPluginElement.blur();
|
| + privates(this).internalElement.blur();
|
| }));
|
| };
|
|
|
| -GuestViewContainer.prototype.attachWindow = function() {
|
| +GuestViewContainer.prototype.attachWindow$ = function() {
|
| if (!this.internalInstanceId) {
|
| return true;
|
| }
|
| @@ -122,22 +122,27 @@ GuestViewContainer.prototype.attachWindow = function() {
|
| return true;
|
| };
|
|
|
| +GuestViewContainer.prototype.onInternalInstanceID = function(
|
| + internalInstanceId) {
|
| + this.internalInstanceId = internalInstanceId;
|
| +
|
| + // Track when the element resizes using the element resize callback.
|
| + GuestViewInternalNatives.RegisterElementResizeCallback(
|
| + this.internalInstanceId, this.weakWrapper(this.onElementResize));
|
| +
|
| + if (!this.guest.getId()) {
|
| + return;
|
| + }
|
| + this.guest.attach(this.internalInstanceId,
|
| + this.viewInstanceId,
|
| + this.buildParams());
|
| +};
|
| +
|
| GuestViewContainer.prototype.handleBrowserPluginAttributeMutation =
|
| function(name, oldValue, newValue) {
|
| if (name == 'internalinstanceid' && !oldValue && !!newValue) {
|
| - privates(this).browserPluginElement.removeAttribute('internalinstanceid');
|
| - this.internalInstanceId = parseInt(newValue);
|
| -
|
| - // Track when the element resizes using the element resize callback.
|
| - GuestViewInternalNatives.RegisterElementResizeCallback(
|
| - this.internalInstanceId, this.weakWrapper(this.onElementResize));
|
| -
|
| - if (!this.guest.getId()) {
|
| - return;
|
| - }
|
| - this.guest.attach(this.internalInstanceId,
|
| - this.viewInstanceId,
|
| - this.buildParams());
|
| + privates(this).internalElement.removeAttribute('internalinstanceid');
|
| + this.onInternalInstanceID(parseInt(newValue));
|
| }
|
| };
|
|
|
|
|