| 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 EventBindings = require('event_bindings'); | 10 var EventBindings = require('event_bindings'); |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 var attributeValue = this.webviewNode.getAttribute('partition'); | 742 var attributeValue = this.webviewNode.getAttribute('partition'); |
| 743 var result = this.partition.fromAttribute(attributeValue, hasNavigated); | 743 var result = this.partition.fromAttribute(attributeValue, hasNavigated); |
| 744 return this.parseSrcAttribute(result); | 744 return this.parseSrcAttribute(result); |
| 745 }; | 745 }; |
| 746 | 746 |
| 747 WebViewInternal.prototype.hasGuestInstanceID = function() { | 747 WebViewInternal.prototype.hasGuestInstanceID = function() { |
| 748 return this.instanceId != undefined; | 748 return this.instanceId != undefined; |
| 749 }; | 749 }; |
| 750 | 750 |
| 751 WebViewInternal.prototype.allocateInstanceId = function() { | 751 WebViewInternal.prototype.allocateInstanceId = function() { |
| 752 // Parse .src and .partition. | 752 var storagePartitionId = |
| 753 this.webviewNode.getAttribute(WEB_VIEW_ATTRIBUTE_PARTITION) || |
| 754 this.webviewNode[WEB_VIEW_ATTRIBUTE_PARTITION]; |
| 755 var params = { |
| 756 'storagePartitionId': storagePartitionId, |
| 757 }; |
| 753 var self = this; | 758 var self = this; |
| 754 GuestViewInternal.allocateInstanceId( | 759 GuestViewInternal.createGuest( |
| 760 'webview', |
| 761 params, |
| 755 function(instanceId) { | 762 function(instanceId) { |
| 756 self.instanceId = instanceId; | 763 self.instanceId = instanceId; |
| 757 // TODO(lazyboy): Make sure this.autoNavigate_ stuff correctly updated | 764 // TODO(lazyboy): Make sure this.autoNavigate_ stuff correctly updated |
| 758 // |self.src| at this point. | 765 // |self.src| at this point. |
| 759 self.attachWindowAndSetUpEvents(self.instanceId, self.src); | 766 self.attachWindowAndSetUpEvents(self.instanceId, self.src); |
| 760 }); | 767 }); |
| 761 }; | 768 }; |
| 762 | 769 |
| 763 /** | 770 /** |
| 764 * @private | 771 * @private |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 | 1450 |
| 1444 /** | 1451 /** |
| 1445 * Implemented when the experimental API is available. | 1452 * Implemented when the experimental API is available. |
| 1446 * @private | 1453 * @private |
| 1447 */ | 1454 */ |
| 1448 WebViewInternal.prototype.setupExperimentalContextMenus_ = function() {}; | 1455 WebViewInternal.prototype.setupExperimentalContextMenus_ = function() {}; |
| 1449 | 1456 |
| 1450 exports.WebView = WebView; | 1457 exports.WebView = WebView; |
| 1451 exports.WebViewInternal = WebViewInternal; | 1458 exports.WebViewInternal = WebViewInternal; |
| 1452 exports.CreateEvent = CreateEvent; | 1459 exports.CreateEvent = CreateEvent; |
| OLD | NEW |