| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 if (this.baseUrlForDataUrl) { | 215 if (this.baseUrlForDataUrl) { |
| 215 webviewSrc = this.baseUrlForDataUrl; | 216 webviewSrc = this.baseUrlForDataUrl; |
| 216 } | 217 } |
| 217 | 218 |
| 218 args = $Array.concat([this.guest.getId(), webviewSrc], | 219 args = $Array.concat([this.guest.getId(), webviewSrc], |
| 219 $Array.slice(args)); | 220 $Array.slice(args)); |
| 220 $Function.apply(func, null, args); | 221 $Function.apply(func, null, args); |
| 221 return true; | 222 return true; |
| 222 } | 223 } |
| 223 | 224 |
| 225 // Requests the <webview> element wihtin the embedder to enter fullscreen. |
| 226 WebViewImpl.prototype.makeElementFullscreen = function() { |
| 227 GuestViewInternalNatives.RunWithGesture(function() { |
| 228 this.element.webkitRequestFullScreen(); |
| 229 }.bind(this)); |
| 230 }; |
| 231 |
| 224 // Implemented when the ChromeWebView API is available. | 232 // Implemented when the ChromeWebView API is available. |
| 225 WebViewImpl.prototype.maybeGetChromeWebViewEvents = function() {}; | 233 WebViewImpl.prototype.maybeGetChromeWebViewEvents = function() {}; |
| 226 | 234 |
| 227 // Implemented when the experimental WebView API is available. | 235 // Implemented when the experimental WebView API is available. |
| 228 WebViewImpl.maybeGetExperimentalApiMethods = function() { return []; }; | 236 WebViewImpl.maybeGetExperimentalApiMethods = function() { return []; }; |
| 229 WebViewImpl.prototype.setupExperimentalContextMenus = function() {}; | 237 WebViewImpl.prototype.setupExperimentalContextMenus = function() {}; |
| 230 | 238 |
| 231 GuestViewContainer.registerElement(WebViewImpl); | 239 GuestViewContainer.registerElement(WebViewImpl); |
| 232 | 240 |
| 233 // Exports. | 241 // Exports. |
| 234 exports.WebViewImpl = WebViewImpl; | 242 exports.WebViewImpl = WebViewImpl; |
| OLD | NEW |