Chromium Code Reviews| Index: extensions/renderer/resources/guest_view/web_view/web_view.js | 
| diff --git a/extensions/renderer/resources/guest_view/web_view/web_view.js b/extensions/renderer/resources/guest_view/web_view/web_view.js | 
| index c58a441edb0aaf175a09c0bcf44aa558b4215f11..332e7ddd404ce1fd6d7db34e5f1e0a82213b7567 100644 | 
| --- a/extensions/renderer/resources/guest_view/web_view/web_view.js | 
| +++ b/extensions/renderer/resources/guest_view/web_view/web_view.js | 
| @@ -14,6 +14,11 @@ var WebViewConstants = require('webViewConstants').WebViewConstants; | 
| var WebViewEvents = require('webViewEvents').WebViewEvents; | 
| var WebViewInternal = require('webViewInternal').WebViewInternal; | 
| +var IdGenerator = requireNative('id_generator'); | 
| +var GuestViewInternalNatives = requireNative('guest_view_internal'); | 
| + | 
| +var LOG = function(msg) { window.console.log(msg); }; | 
| + | 
| // Represents the internal state of <webview>. | 
| function WebViewImpl(webviewElement) { | 
| GuestViewContainer.call(this, webviewElement, 'webview'); | 
| @@ -59,6 +64,7 @@ WebViewImpl.prototype.onElementAttached = function() { | 
| for (var i in this.attributes) { | 
| this.attributes[i].dirty = true; | 
| } | 
| + // FIXME: Not sure about this one. | 
| for (var i in this.attributes) { | 
| this.attributes[i].attach(); | 
| } | 
| @@ -188,9 +194,44 @@ WebViewImpl.prototype.attachWindow = function(opt_guestInstanceId) { | 
| this.guest = new GuestView('webview', opt_guestInstanceId); | 
| } | 
| + if (GuestViewInternalNatives.IsSitePerProcess()) { | 
| + return this.attachForSitePerProcess(); | 
| + } | 
| + | 
| + if (!this.internalInstanceId) { | 
| + return true; | 
| + } | 
| + | 
| return GuestViewContainer.prototype.attachWindow.call(this); | 
| }; | 
| +WebViewImpl.prototype.attachForSitePerProcess = function() { | 
| + LOG('Guest will start attach'); | 
| + var generatedId = IdGenerator.GetNextId(); | 
| + this.internalInstanceId = generatedId; | 
| + | 
| + LOG('this.guest.getId() = ' + this.guest.getId()); | 
| + window.console.log(this.getBrowserPluginElement()); | 
| + var ret = GuestViewInternalNatives.AttachIframeGuest( | 
| + this.internalInstanceId, this.guest.getId(), | 
| + this.getBrowserPluginElement(), function(contentWindow) { | 
| + LOG(contentWindow); | 
| + this.guest.setContentWindow(contentWindow); | 
| + }.bind(this)); | 
| + | 
| + LOG('guestViewInternalNatives.AttachIframeGuest status: ' + ret); | 
| + | 
| + window.setTimeout(function() { | 
| + LOG('<webview>: navigate'); | 
| + var src = | 
| + this.attributes[WebViewConstants.ATTRIBUTE_SRC].getValue(); | 
| + WebViewInternal.navigate( | 
| 
 
Fady Samuel
2015/04/28 17:56:11
This breaks webview expectations now. What happene
 
 | 
| + this.guest.getId(), src); | 
| + }.bind(this), 0); | 
| + | 
| + return true; | 
| +}; | 
| + | 
| // Shared implementation of executeScript() and insertCSS(). | 
| WebViewImpl.prototype.executeCode = function(func, args) { | 
| if (!this.guest.getId()) { |