| 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 WebViewConstants = require('webViewConstants').WebViewConstants; | 13 var WebViewConstants = require('webViewConstants').WebViewConstants; |
| 13 var WebViewEvents = require('webViewEvents').WebViewEvents; | 14 var WebViewEvents = require('webViewEvents').WebViewEvents; |
| 14 var WebViewInternal = require('webViewInternal').WebViewInternal; | 15 var WebViewInternal = require('webViewInternal').WebViewInternal; |
| 15 | 16 |
| 16 // Represents the internal state of <webview>. | 17 // Represents the internal state of <webview>. |
| 17 function WebViewImpl(webviewElement) { | 18 function WebViewImpl(webviewElement) { |
| 18 GuestViewContainer.call(this, webviewElement, 'webview'); | 19 GuestViewContainer.call(this, webviewElement, 'webview'); |
| 19 | 20 |
| 20 this.setupWebViewAttributes(); | 21 this.setupWebViewAttributes(); |
| 21 this.setupElementProperties(); | 22 this.setupElementProperties(); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 if (this.baseUrlForDataUrl) { | 210 if (this.baseUrlForDataUrl) { |
| 210 webviewSrc = this.baseUrlForDataUrl; | 211 webviewSrc = this.baseUrlForDataUrl; |
| 211 } | 212 } |
| 212 | 213 |
| 213 args = $Array.concat([this.guest.getId(), webviewSrc], | 214 args = $Array.concat([this.guest.getId(), webviewSrc], |
| 214 $Array.slice(args)); | 215 $Array.slice(args)); |
| 215 $Function.apply(func, null, args); | 216 $Function.apply(func, null, args); |
| 216 return true; | 217 return true; |
| 217 } | 218 } |
| 218 | 219 |
| 220 // Requests the <webview> element wihtin the embedder to enter fullscreen. |
| 221 WebViewImpl.prototype.makeElementFullscreen = function() { |
| 222 GuestViewInternalNatives.RunWithGesture(function() { |
| 223 this.element.webkitRequestFullScreen(); |
| 224 }.bind(this)); |
| 225 }; |
| 226 |
| 219 // Implemented when the ChromeWebView API is available. | 227 // Implemented when the ChromeWebView API is available. |
| 220 WebViewImpl.prototype.maybeSetupContextMenus = function() {}; | 228 WebViewImpl.prototype.maybeSetupContextMenus = function() {}; |
| 221 | 229 |
| 222 GuestViewContainer.registerElement(WebViewImpl); | 230 GuestViewContainer.registerElement(WebViewImpl); |
| 223 | 231 |
| 224 // Exports. | 232 // Exports. |
| 225 exports.WebViewImpl = WebViewImpl; | 233 exports.WebViewImpl = WebViewImpl; |
| OLD | NEW |