Chromium Code Reviews| Index: extensions/renderer/resources/guest_view/guest_view.js |
| diff --git a/extensions/renderer/resources/guest_view/guest_view.js b/extensions/renderer/resources/guest_view/guest_view.js |
| index 27368a488f792040d6cfcfd90d270f48dc8ffd46..350c5f431db181c4a86ff94abab777690a7d6cf8 100644 |
| --- a/extensions/renderer/resources/guest_view/guest_view.js |
| +++ b/extensions/renderer/resources/guest_view/guest_view.js |
| @@ -139,11 +139,16 @@ GuestViewImpl.prototype.attachImpl = function( |
| return; |
| } |
| + var isSitePerProcess = GuestViewInternalNatives.IsSitePerProcess(); |
| // Callback wrapper function to store the contentWindow from the attachGuest() |
| // callback, handle potential attaching failure, register an automatic detach, |
| // and advance the queue. |
| var callbackWrapper = function(callback, contentWindow) { |
| // Check if attaching failed. |
| + if (isSitePerProcess) { |
| + contentWindow = this.guestView.browserPluginElement.contentWindow; |
|
Fady Samuel
2015/05/26 16:42:15
Why are you using browserPluginElement for sitePer
|
| + } |
| + |
| if (!contentWindow) { |
| this.state = GUEST_STATE_CREATED; |
| this.internalInstanceId = 0; |
| @@ -156,10 +161,17 @@ GuestViewImpl.prototype.attachImpl = function( |
| }; |
| attachParams['instanceId'] = viewInstanceId; |
| - GuestViewInternalNatives.AttachGuest(internalInstanceId, |
| - this.id, |
| - attachParams, |
| - callbackWrapper.bind(this, callback)); |
| + if (isSitePerProcess) { |
| + var contentWindow = this.guestView.browserPluginElement.contentWindow; |
| + GuestViewInternalNatives.AttachIframeGuest( |
| + internalInstanceId, this.id, attachParams, contentWindow, |
| + callbackWrapper.bind(this, callback)); |
| + } else { |
| + GuestViewInternalNatives.AttachGuest(internalInstanceId, |
| + this.id, |
| + attachParams, |
| + callbackWrapper.bind(this, callback)); |
| + } |
| this.internalInstanceId = internalInstanceId; |
| this.state = GUEST_STATE_ATTACHED; |
| @@ -185,13 +197,16 @@ GuestViewImpl.prototype.createImpl = function(createParams, callback) { |
| return; |
| } |
| + var isSitePerProcess = GuestViewInternalNatives.IsSitePerProcess(); |
| // Callback wrapper function to store the guestInstanceId from the |
| // createGuest() callback, handle potential creation failure, and advance the |
| // queue. |
| var callbackWrapper = function(callback, guestInfo) { |
| this.id = guestInfo.id; |
| - this.contentWindow = |
| - GuestViewInternalNatives.GetContentWindow(guestInfo.contentWindowId); |
| + if (!isSitePerProcess) { |
| + this.contentWindow = |
| + GuestViewInternalNatives.GetContentWindow(guestInfo.contentWindowId); |
| + } |
| // Check if creation failed. |
| if (this.id === 0) { |
| @@ -277,6 +292,10 @@ function GuestView(viewType, guestInstanceId) { |
| privates(this).internal = new GuestViewImpl(this, viewType, guestInstanceId); |
| } |
| +GuestView.prototype.setBrowserPluginElement = function(browserPluginElement) { |
| + this.browserPluginElement = browserPluginElement; |
| +} |
| + |
| // Attaches the guestview to the container with ID |internalInstanceId|. |
| GuestView.prototype.attach = function( |
| internalInstanceId, viewInstanceId, attachParams, callback) { |