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 GuestView = require('guestView').GuestView; | 10 var GuestView = require('guestView').GuestView; |
11 var GuestViewContainer = require('guestViewContainer').GuestViewContainer; | 11 var GuestViewContainer = require('guestViewContainer').GuestViewContainer; |
12 var GuestViewInternalNatives = requireNative('guest_view_internal'); | 12 var GuestViewInternalNatives = requireNative('guest_view_internal'); |
13 var WebViewConstants = require('webViewConstants').WebViewConstants; | 13 var WebViewConstants = require('webViewConstants').WebViewConstants; |
14 var WebViewEvents = require('webViewEvents').WebViewEvents; | 14 var WebViewEvents = require('webViewEvents').WebViewEvents; |
15 var WebViewInternal = require('webViewInternal').WebViewInternal; | 15 var WebViewInternal = require('webViewInternal').WebViewInternal; |
16 | 16 |
17 // Represents the internal state of <webview>. | 17 // Represents the internal state of <webview>. |
18 function WebViewImpl(webviewElement) { | 18 function WebViewImpl(webviewElement) { |
19 GuestViewContainer.call(this, webviewElement, 'webview'); | 19 GuestViewContainer.call(this, webviewElement, 'webview'); |
20 this.cachedZoom = 1; | 20 this.cachedZoom = 1; |
21 this.setupElementProperties(); | 21 this.setupElementProperties(); |
22 new WebViewEvents(this, this.viewInstanceId); | 22 new WebViewEvents(this, this.viewInstanceId); |
| 23 WebViewInternal.reportExtensionId(this.viewInstanceId); |
23 } | 24 } |
24 | 25 |
25 WebViewImpl.prototype.__proto__ = GuestViewContainer.prototype; | 26 WebViewImpl.prototype.__proto__ = GuestViewContainer.prototype; |
26 | 27 |
27 WebViewImpl.VIEW_TYPE = 'WebView'; | 28 WebViewImpl.VIEW_TYPE = 'WebView'; |
28 | 29 |
29 // Add extra functionality to |this.element|. | 30 // Add extra functionality to |this.element|. |
30 WebViewImpl.setupElement = function(proto) { | 31 WebViewImpl.setupElement = function(proto) { |
31 // Public-facing API methods. | 32 // Public-facing API methods. |
32 var apiMethods = WebViewImpl.getApiMethods(); | 33 var apiMethods = WebViewImpl.getApiMethods(); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 }.bind(this)); | 218 }.bind(this)); |
218 }; | 219 }; |
219 | 220 |
220 // Implemented when the ChromeWebView API is available. | 221 // Implemented when the ChromeWebView API is available. |
221 WebViewImpl.prototype.maybeSetupContextMenus = function() {}; | 222 WebViewImpl.prototype.maybeSetupContextMenus = function() {}; |
222 | 223 |
223 GuestViewContainer.registerElement(WebViewImpl); | 224 GuestViewContainer.registerElement(WebViewImpl); |
224 | 225 |
225 // Exports. | 226 // Exports. |
226 exports.WebViewImpl = WebViewImpl; | 227 exports.WebViewImpl = WebViewImpl; |
OLD | NEW |