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; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 }; | 234 }; |
235 | 235 |
236 // Shared implementation of executeScript() and insertCSS(). | 236 // Shared implementation of executeScript() and insertCSS(). |
237 WebViewImpl.prototype.executeCode = function(func, args) { | 237 WebViewImpl.prototype.executeCode = function(func, args) { |
238 if (!this.guest.getId()) { | 238 if (!this.guest.getId()) { |
239 window.console.error(WebViewConstants.ERROR_MSG_CANNOT_INJECT_SCRIPT); | 239 window.console.error(WebViewConstants.ERROR_MSG_CANNOT_INJECT_SCRIPT); |
240 return false; | 240 return false; |
241 } | 241 } |
242 | 242 |
243 var webviewSrc = this.attributes[WebViewConstants.ATTRIBUTE_SRC].getValue(); | 243 var webviewSrc = this.attributes[WebViewConstants.ATTRIBUTE_SRC].getValue(); |
244 if (this.baseUrlForDataUrl != '') { | 244 if (this.baseUrlForDataUrl) { |
245 webviewSrc = this.baseUrlForDataUrl; | 245 webviewSrc = this.baseUrlForDataUrl; |
246 } | 246 } |
247 | 247 |
248 args = $Array.concat([this.guest.getId(), webviewSrc], | 248 args = $Array.concat([this.guest.getId(), webviewSrc], |
249 $Array.slice(args)); | 249 $Array.slice(args)); |
250 $Function.apply(func, null, args); | 250 $Function.apply(func, null, args); |
251 return true; | 251 return true; |
252 } | 252 } |
253 | 253 |
254 // Implemented when the ChromeWebView API is available. | 254 // Implemented when the ChromeWebView API is available. |
255 WebViewImpl.prototype.maybeGetChromeWebViewEvents = function() {}; | 255 WebViewImpl.prototype.maybeGetChromeWebViewEvents = function() {}; |
256 | 256 |
257 // Implemented when the experimental WebView API is available. | 257 // Implemented when the experimental WebView API is available. |
258 WebViewImpl.maybeGetExperimentalApiMethods = function() { return []; }; | 258 WebViewImpl.maybeGetExperimentalApiMethods = function() { return []; }; |
259 WebViewImpl.prototype.setupExperimentalContextMenus = function() {}; | 259 WebViewImpl.prototype.setupExperimentalContextMenus = function() {}; |
260 WebViewImpl.prototype.maybeSetupExperimentalChromeWebViewEvents = | 260 WebViewImpl.prototype.maybeSetupExperimentalChromeWebViewEvents = |
261 function(request) { | 261 function(request) { |
262 return request; | 262 return request; |
263 }; | 263 }; |
264 | 264 |
265 GuestViewContainer.registerElement(WebViewImpl); | 265 GuestViewContainer.registerElement(WebViewImpl); |
266 | 266 |
267 // Exports. | 267 // Exports. |
268 exports.WebViewImpl = WebViewImpl; | 268 exports.WebViewImpl = WebViewImpl; |
OLD | NEW |