| 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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 WebViewInternal.prototype.setUserAgentOverride = function(userAgentOverride) { | 743 WebViewInternal.prototype.setUserAgentOverride = function(userAgentOverride) { |
| 744 this.userAgentOverride = userAgentOverride; | 744 this.userAgentOverride = userAgentOverride; |
| 745 if (!this.instanceId) { | 745 if (!this.instanceId) { |
| 746 // If we are not attached yet, then we will pick up the user agent on | 746 // If we are not attached yet, then we will pick up the user agent on |
| 747 // attachment. | 747 // attachment. |
| 748 return; | 748 return; |
| 749 } | 749 } |
| 750 WebView.overrideUserAgent(this.instanceId, userAgentOverride); | 750 WebView.overrideUserAgent(this.instanceId, userAgentOverride); |
| 751 }; | 751 }; |
| 752 | 752 |
| 753 /** @private */ |
| 754 WebViewInternal.prototype.find = function(search_text, options, callback) { |
| 755 if (!this.instanceId) { |
| 756 return; |
| 757 } |
| 758 WebView.find(this.instanceId, search_text, options, callback); |
| 759 }; |
| 760 |
| 761 /** @private */ |
| 762 WebViewInternal.prototype.stopFinding = function(action) { |
| 763 if (!this.instanceId) { |
| 764 return; |
| 765 } |
| 766 WebView.stopFinding(this.instanceId, action); |
| 767 }; |
| 768 |
| 753 WebViewInternal.prototype.buildAttachParams = function(isNewWindow) { | 769 WebViewInternal.prototype.buildAttachParams = function(isNewWindow) { |
| 754 var params = { | 770 var params = { |
| 755 'api': 'webview', | 771 'api': 'webview', |
| 756 'instanceId': this.viewInstanceId, | 772 'instanceId': this.viewInstanceId, |
| 757 'name': this.name, | 773 'name': this.name, |
| 758 // We don't need to navigate new window from here. | 774 // We don't need to navigate new window from here. |
| 759 'src': isNewWindow ? undefined : this.src, | 775 'src': isNewWindow ? undefined : this.src, |
| 760 // If we have a partition from the opener, that will also be already | 776 // If we have a partition from the opener, that will also be already |
| 761 // set via this.onAttach(). | 777 // set via this.onAttach(). |
| 762 'storagePartitionId': this.partition.toAttribute(), | 778 'storagePartitionId': this.partition.toAttribute(), |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 if (this.customElementDetached) { | 856 if (this.customElementDetached) { |
| 841 var webViewInternal = privates(this).internal; | 857 var webViewInternal = privates(this).internal; |
| 842 webViewInternal.resetUponReattachment(); | 858 webViewInternal.resetUponReattachment(); |
| 843 webViewInternal.allocateInstanceId(); | 859 webViewInternal.allocateInstanceId(); |
| 844 } | 860 } |
| 845 this.customElementDetached = false; | 861 this.customElementDetached = false; |
| 846 }; | 862 }; |
| 847 | 863 |
| 848 var methods = [ | 864 var methods = [ |
| 849 'back', | 865 'back', |
| 866 'find', |
| 850 'forward', | 867 'forward', |
| 851 'canGoBack', | 868 'canGoBack', |
| 852 'canGoForward', | 869 'canGoForward', |
| 853 'clearData', | 870 'clearData', |
| 854 'getProcessId', | 871 'getProcessId', |
| 855 'go', | 872 'go', |
| 856 'print', | 873 'print', |
| 857 'reload', | 874 'reload', |
| 858 'stop', | 875 'stop', |
| 876 'stopFinding', |
| 859 'terminate', | 877 'terminate', |
| 860 'executeScript', | 878 'executeScript', |
| 861 'insertCSS', | 879 'insertCSS', |
| 862 'getUserAgent', | 880 'getUserAgent', |
| 863 'isUserAgentOverridden', | 881 'isUserAgentOverridden', |
| 864 'setUserAgentOverride' | 882 'setUserAgentOverride' |
| 865 ]; | 883 ]; |
| 866 | 884 |
| 867 // Forward proto.foo* method calls to WebViewInternal.foo*. | 885 // Forward proto.foo* method calls to WebViewInternal.foo*. |
| 868 for (var i = 0; methods[i]; ++i) { | 886 for (var i = 0; methods[i]; ++i) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 }; | 945 }; |
| 928 | 946 |
| 929 /** | 947 /** |
| 930 * Implemented when the experimental API is available. | 948 * Implemented when the experimental API is available. |
| 931 * @private | 949 * @private |
| 932 */ | 950 */ |
| 933 WebViewInternal.prototype.setupExperimentalContextMenus = function() {}; | 951 WebViewInternal.prototype.setupExperimentalContextMenus = function() {}; |
| 934 | 952 |
| 935 exports.WebView = WebView; | 953 exports.WebView = WebView; |
| 936 exports.WebViewInternal = WebViewInternal; | 954 exports.WebViewInternal = WebViewInternal; |
| OLD | NEW |