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 = |
11 require('binding').Binding.create('guestViewInternal').generate(); | 11 require('binding').Binding.create('guestViewInternal').generate(); |
12 var IdGenerator = requireNative('id_generator'); | 12 var IdGenerator = requireNative('id_generator'); |
| 13 var ChromeWebView = require('chromeWebViewInternal').ChromeWebView |
13 // TODO(lazyboy): Rename this to WebViewInternal and call WebViewInternal | 14 // TODO(lazyboy): Rename this to WebViewInternal and call WebViewInternal |
14 // something else. | 15 // something else. |
15 var WebView = require('webViewInternal').WebView; | 16 var WebView = require('webViewInternal').WebView; |
16 var WebViewEvents = require('webViewEvents').WebViewEvents; | 17 var WebViewEvents = require('webViewEvents').WebViewEvents; |
17 var guestViewInternalNatives = requireNative('guest_view_internal'); | 18 var guestViewInternalNatives = requireNative('guest_view_internal'); |
18 | 19 |
19 var WEB_VIEW_ATTRIBUTE_AUTOSIZE = 'autosize'; | 20 var WEB_VIEW_ATTRIBUTE_AUTOSIZE = 'autosize'; |
20 var WEB_VIEW_ATTRIBUTE_MAXHEIGHT = 'maxheight'; | 21 var WEB_VIEW_ATTRIBUTE_MAXHEIGHT = 'maxheight'; |
21 var WEB_VIEW_ATTRIBUTE_MAXWIDTH = 'maxwidth'; | 22 var WEB_VIEW_ATTRIBUTE_MAXWIDTH = 'maxwidth'; |
22 var WEB_VIEW_ATTRIBUTE_MINHEIGHT = 'minheight'; | 23 var WEB_VIEW_ATTRIBUTE_MINHEIGHT = 'minheight'; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 }; | 232 }; |
232 | 233 |
233 /** | 234 /** |
234 * @private | 235 * @private |
235 */ | 236 */ |
236 WebViewInternal.prototype.clearData = function() { | 237 WebViewInternal.prototype.clearData = function() { |
237 if (!this.guestInstanceId) { | 238 if (!this.guestInstanceId) { |
238 return; | 239 return; |
239 } | 240 } |
240 var args = $Array.concat([this.guestInstanceId], $Array.slice(arguments)); | 241 var args = $Array.concat([this.guestInstanceId], $Array.slice(arguments)); |
241 $Function.apply(WebView.clearData, null, args); | 242 $Function.apply(ChromeWebView.clearData, null, args); |
242 }; | 243 }; |
243 | 244 |
244 /** | 245 /** |
245 * @private | 246 * @private |
246 */ | 247 */ |
247 WebViewInternal.prototype.getProcessId = function() { | 248 WebViewInternal.prototype.getProcessId = function() { |
248 return this.processId; | 249 return this.processId; |
249 }; | 250 }; |
250 | 251 |
251 /** | 252 /** |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 * Calls to show contextmenu right away instead of dispatching a 'contextmenu' | 1029 * Calls to show contextmenu right away instead of dispatching a 'contextmenu' |
1029 * event. | 1030 * event. |
1030 * This will be overridden in web_view_experimental.js to implement contextmenu | 1031 * This will be overridden in web_view_experimental.js to implement contextmenu |
1031 * API. | 1032 * API. |
1032 */ | 1033 */ |
1033 WebViewInternal.prototype.maybeHandleContextMenu = function(e, webViewEvent) { | 1034 WebViewInternal.prototype.maybeHandleContextMenu = function(e, webViewEvent) { |
1034 var requestId = e.requestId; | 1035 var requestId = e.requestId; |
1035 // Setting |params| = undefined will show the context menu unmodified, hence | 1036 // Setting |params| = undefined will show the context menu unmodified, hence |
1036 // the 'contextmenu' API is disabled for stable channel. | 1037 // the 'contextmenu' API is disabled for stable channel. |
1037 var params = undefined; | 1038 var params = undefined; |
1038 WebView.showContextMenu(this.guestInstanceId, requestId, params); | 1039 ChromeWebView.showContextMenu(this.guestInstanceId, requestId, params); |
1039 }; | 1040 }; |
1040 | 1041 |
1041 /** | 1042 /** |
1042 * Implemented when the experimental API is available. | 1043 * Implemented when the experimental API is available. |
1043 * @private | 1044 * @private |
1044 */ | 1045 */ |
1045 WebViewInternal.prototype.setupExperimentalContextMenus = function() {}; | 1046 WebViewInternal.prototype.setupExperimentalContextMenus = function() {}; |
1046 | 1047 |
1047 exports.WebView = WebView; | 1048 exports.WebView = WebView; |
1048 exports.WebViewInternal = WebViewInternal; | 1049 exports.WebViewInternal = WebViewInternal; |
OLD | NEW |