| 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..36365a3b24bdb5ddf8309debc1dbe7c2deec1670 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);
|
| }
|
| @@ -51,8 +51,7 @@ GuestViewContainer.registerElement = function(guestViewContainerType) {
|
| if (document.readyState == 'loading')
|
| return;
|
|
|
| - registerBrowserPluginElement(
|
| - guestViewContainerType.VIEW_TYPE.toLowerCase());
|
| + registerInternalElement(guestViewContainerType.VIEW_TYPE.toLowerCase());
|
| registerGuestViewElement(guestViewContainerType);
|
| window.removeEventListener(event.type, listener, useCapture);
|
| }, useCapture);
|
| @@ -84,7 +83,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 +102,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 +121,27 @@ GuestViewContainer.prototype.attachWindow = function() {
|
| return true;
|
| };
|
|
|
| -GuestViewContainer.prototype.handleBrowserPluginAttributeMutation =
|
| - function(name, oldValue, newValue) {
|
| - if (name == 'internalinstanceid' && !oldValue && !!newValue) {
|
| - privates(this).browserPluginElement.removeAttribute('internalinstanceid');
|
| - this.internalInstanceId = parseInt(newValue);
|
| +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));
|
| + // 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());
|
| + if (!this.guest.getId()) {
|
| + return;
|
| + }
|
| + this.guest.attach(this.internalInstanceId,
|
| + this.viewInstanceId,
|
| + this.buildParams());
|
| +};
|
| +
|
| +GuestViewContainer.prototype.handleInternalElementAttributeMutation =
|
| + function(name, oldValue, newValue) {
|
| + if (name == 'internalinstanceid' && !oldValue && !!newValue) {
|
| + privates(this).internalElement.removeAttribute('internalinstanceid');
|
| + this.onInternalInstanceId(parseInt(newValue));
|
| }
|
| };
|
|
|
| @@ -187,7 +191,7 @@ GuestViewContainer.prototype.setupAttributes = function() {};
|
|
|
| // Registers the browser plugin <object> custom element. |viewType| is the
|
| // name of the specific guestview container (e.g. 'webview').
|
| -function registerBrowserPluginElement(viewType) {
|
| +function registerInternalElement(viewType) {
|
| var proto = $Object.create(HTMLElement.prototype);
|
|
|
| proto.createdCallback = function() {
|
| @@ -207,7 +211,7 @@ function registerBrowserPluginElement(viewType) {
|
| if (!internal) {
|
| return;
|
| }
|
| - internal.handleBrowserPluginAttributeMutation(name, oldValue, newValue);
|
| + internal.handleInternalElementAttributeMutation(name, oldValue, newValue);
|
| };
|
|
|
| GuestViewContainer[viewType + 'BrowserPlugin'] =
|
|
|