| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This module implements Webview (<webview>) as a custom element that wraps a | 5 // This module implements Webview (<webview>) as a custom element that wraps a |
| 6 // BrowserPlugin object element. The object element is hidden within | 6 // BrowserPlugin object element. The object element is hidden within |
| 7 // the shadow DOM of the Webview element. | 7 // the shadow DOM of the Webview element. |
| 8 | 8 |
| 9 var DocumentNatives = requireNative('document_natives'); | 9 var DocumentNatives = requireNative('document_natives'); |
| 10 var GuestViewInternal = | 10 var GuestViewInternal = |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 var attributeValue = this.webviewNode.getAttribute('partition'); | 605 var attributeValue = this.webviewNode.getAttribute('partition'); |
| 606 var result = this.partition.fromAttribute(attributeValue, hasNavigated); | 606 var result = this.partition.fromAttribute(attributeValue, hasNavigated); |
| 607 return this.parseSrcAttribute(result); | 607 return this.parseSrcAttribute(result); |
| 608 }; | 608 }; |
| 609 | 609 |
| 610 WebViewInternal.prototype.hasGuestInstanceID = function() { | 610 WebViewInternal.prototype.hasGuestInstanceID = function() { |
| 611 return this.instanceId != undefined; | 611 return this.instanceId != undefined; |
| 612 }; | 612 }; |
| 613 | 613 |
| 614 WebViewInternal.prototype.allocateInstanceId = function() { | 614 WebViewInternal.prototype.allocateInstanceId = function() { |
| 615 // Parse .src and .partition. | 615 var storagePartitionId = |
| 616 this.webviewNode.getAttribute(WEB_VIEW_ATTRIBUTE_PARTITION) || |
| 617 this.webviewNode[WEB_VIEW_ATTRIBUTE_PARTITION]; |
| 618 var params = { |
| 619 'storagePartitionId': storagePartitionId, |
| 620 }; |
| 616 var self = this; | 621 var self = this; |
| 617 GuestViewInternal.allocateInstanceId( | 622 GuestViewInternal.createGuest( |
| 623 'webview', |
| 624 params, |
| 618 function(instanceId) { | 625 function(instanceId) { |
| 619 self.instanceId = instanceId; | 626 self.instanceId = instanceId; |
| 620 // TODO(lazyboy): Make sure this.autoNavigate_ stuff correctly updated | 627 // TODO(lazyboy): Make sure this.autoNavigate_ stuff correctly updated |
| 621 // |self.src| at this point. | 628 // |self.src| at this point. |
| 622 self.attachWindowAndSetUpEvents(self.instanceId, self.src); | 629 self.attachWindowAndSetUpEvents(self.instanceId, self.src); |
| 623 }); | 630 }); |
| 624 }; | 631 }; |
| 625 | 632 |
| 626 WebViewInternal.prototype.onFrameNameChanged = function(name) { | 633 WebViewInternal.prototype.onFrameNameChanged = function(name) { |
| 627 this.name = name || ''; | 634 this.name = name || ''; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 }; | 878 }; |
| 872 | 879 |
| 873 /** | 880 /** |
| 874 * Implemented when the experimental API is available. | 881 * Implemented when the experimental API is available. |
| 875 * @private | 882 * @private |
| 876 */ | 883 */ |
| 877 WebViewInternal.prototype.setupExperimentalContextMenus = function() {}; | 884 WebViewInternal.prototype.setupExperimentalContextMenus = function() {}; |
| 878 | 885 |
| 879 exports.WebView = WebView; | 886 exports.WebView = WebView; |
| 880 exports.WebViewInternal = WebViewInternal; | 887 exports.WebViewInternal = WebViewInternal; |
| OLD | NEW |