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 5b6a736758ffe04dbec929baf704ec9289618e24..cb131a382121b1b961330742c094f926dfde203b 100644 |
--- a/extensions/renderer/resources/guest_view/guest_view_container.js |
+++ b/extensions/renderer/resources/guest_view/guest_view_container.js |
@@ -91,6 +91,10 @@ GuestViewContainer.prototype.createBrowserPluginElement = function() { |
return browserPluginElement; |
}; |
+GuestViewContainer.prototype.getBrowserPluginElement = function() { |
+ return privates(this).browserPluginElement; |
+}; |
+ |
GuestViewContainer.prototype.setupFocusPropagation = function() { |
if (!this.element.hasAttribute('tabIndex')) { |
// GuestViewContainer needs a tabIndex in order to be focusable. |
@@ -184,11 +188,17 @@ 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) { |
- var proto = Object.create(HTMLObjectElement.prototype); |
+ //var proto = Object.create(HTMLObjectElement.prototype); |
+ var proto = Object.create(HTMLIFrameElement.prototype); |
+ |
+ var isSitePerProcess = GuestViewInternalNatives.IsSitePerProcess(); |
+ window.console.log('isSitePerProcess: ' + isSitePerProcess); |
proto.createdCallback = function() { |
- this.setAttribute('type', 'application/browser-plugin'); |
- this.setAttribute('id', 'browser-plugin-' + IdGenerator.GetNextId()); |
+ if (!isSitePerProcess) { |
+ this.setAttribute('type', 'application/browser-plugin'); |
+ this.setAttribute('id', 'browser-plugin-' + IdGenerator.GetNextId()); |
+ } |
this.style.width = '100%'; |
this.style.height = '100%'; |
}; |
@@ -198,17 +208,20 @@ function registerBrowserPluginElement(viewType) { |
var unused = this.nonExistentAttribute; |
}; |
- proto.attributeChangedCallback = function(name, oldValue, newValue) { |
- var internal = privates(this).internal; |
- if (!internal) { |
- return; |
- } |
- internal.handleBrowserPluginAttributeMutation(name, oldValue, newValue); |
- }; |
+ if (!isSitePerProcess) { |
+ proto.attributeChangedCallback = function(name, oldValue, newValue) { |
+ var internal = privates(this).internal; |
+ if (!internal) { |
+ return; |
+ } |
+ internal.handleBrowserPluginAttributeMutation(name, oldValue, newValue); |
+ }; |
+ } |
+ var options = {prototype: proto}; |
+ options.extends = isSitePerProcess ? 'iframe' : 'object'; |
GuestViewContainer[viewType + 'BrowserPlugin'] = |
- DocumentNatives.RegisterElement(viewType + 'browserplugin', |
- {extends: 'object', prototype: proto}); |
+ DocumentNatives.RegisterElement(viewType + 'browserplugin', options); |
delete proto.createdCallback; |
delete proto.attachedCallback; |