| 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..1d92fc2c653610ee2d0aff315bed40ebc46759e5 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,47 @@ 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().contentWindow, function() {
|
| + // TODO(lazyboy): Once http://crbug.com/480676 is fixed, we won't need
|
| + // to set contentWindow in callback, we can use <webview>.contentWindow
|
| + // to point to <iframe>.contentWindow right after creation.
|
| + var frameContentWindow = this.getBrowserPluginElement().contentWindow;
|
| + this.guest.setContentWindow(frameContentWindow);
|
| + }.bind(this));
|
| +
|
| + LOG('guestViewInternalNatives.AttachIframeGuest status: ' + ret);
|
| +
|
| + window.setTimeout(function() {
|
| + LOG('<webview>: navigate');
|
| + var src =
|
| + this.attributes[WebViewConstants.ATTRIBUTE_SRC].getValue();
|
| + WebViewInternal.navigate(
|
| + 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()) {
|
|
|