Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // 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.
| |
| 6 // See web_view.js for details. | |
| 7 | |
| 8 var IdGenerator = requireNative('id_generator'); | |
| 9 var WebViewImpl = require('webView').WebViewImpl; | |
| 10 // NOTE: Do not remove these, we implicitly depend on these in | |
| 11 // --site-per-process. | |
| 12 var GuestViewIframe = require('guestViewIframe'); | |
| 13 var GuestViewIframeContainer = require('guestViewIframeContainer'); | |
| 14 | |
| 15 WebViewImpl.prototype.attachWindow$ = function(opt_guestInstanceId) { | |
| 16 // If |opt_guestInstanceId| was provided, then a different existing guest is | |
| 17 // being attached to this webview, and the current one will get destroyed. | |
| 18 if (opt_guestInstanceId) { | |
| 19 if (this.guest.getId() == opt_guestInstanceId) { | |
| 20 return true; | |
| 21 } | |
| 22 this.guest.destroy(); | |
| 23 this.guest = new GuestView('webview', opt_guestInstanceId); | |
| 24 } | |
| 25 | |
| 26 var generatedID = IdGenerator.GetNextId(); | |
| 27 // We do have a plugin to set our instance id, so do it here. | |
| 28 this.onInternalInstanceID(generatedID); | |
| 29 return true; | |
| 30 }; | |
| OLD | NEW |