Index: extensions/renderer/resources/guest_view/web_view/web_view_iframe.js |
diff --git a/extensions/renderer/resources/guest_view/web_view/web_view_iframe.js b/extensions/renderer/resources/guest_view/web_view/web_view_iframe.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fe0eb27c3fe3509e37e2bc570a0dc5a507d9647e |
--- /dev/null |
+++ b/extensions/renderer/resources/guest_view/web_view/web_view_iframe.js |
@@ -0,0 +1,30 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// This module implements provides OOPIF overrides for WebView (<webview>). |
paulmeyer
2015/06/08 13:37:38
nit: choose one of 'implements' or 'provides'.
Al
lazyboy
2015/06/09 18:48:22
Done.
|
+// See web_view.js for details. |
+ |
+var IdGenerator = requireNative('id_generator'); |
+var WebViewImpl = require('webView').WebViewImpl; |
+// NOTE: Do not remove these, we implicitly depend on these in |
+// --site-per-process. |
+var GuestViewIframe = require('guestViewIframe'); |
+var GuestViewIframeContainer = require('guestViewIframeContainer'); |
+ |
+WebViewImpl.prototype.attachWindow$ = function(opt_guestInstanceId) { |
+ // If |opt_guestInstanceId| was provided, then a different existing guest is |
+ // being attached to this webview, and the current one will get destroyed. |
+ if (opt_guestInstanceId) { |
+ if (this.guest.getId() == opt_guestInstanceId) { |
+ return true; |
+ } |
+ this.guest.destroy(); |
+ this.guest = new GuestView('webview', opt_guestInstanceId); |
+ } |
+ |
+ var generatedID = IdGenerator.GetNextId(); |
+ // We do have a plugin to set our instance id, so do it here. |
+ this.onInternalInstanceID(generatedID); |
+ return true; |
+}; |