| 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 guestViewInternalNatives = requireNative('guest_view_internal'); | 12 var guestViewInternalNatives = requireNative('guest_view_internal'); |
| 13 var IdGenerator = requireNative('id_generator'); | 13 var IdGenerator = requireNative('id_generator'); |
| 14 var WebViewConstants = require('webViewConstants').WebViewConstants; |
| 14 var WebViewEvents = require('webViewEvents').WebViewEvents; | 15 var WebViewEvents = require('webViewEvents').WebViewEvents; |
| 15 var WebViewInternal = require('webViewInternal').WebViewInternal; | 16 var WebViewInternal = require('webViewInternal').WebViewInternal; |
| 16 | 17 |
| 17 // Attributes. | |
| 18 var WEB_VIEW_ATTRIBUTE_ALLOWTRANSPARENCY = 'allowtransparency'; | |
| 19 var WEB_VIEW_ATTRIBUTE_AUTOSIZE = 'autosize'; | |
| 20 var WEB_VIEW_ATTRIBUTE_MAXHEIGHT = 'maxheight'; | |
| 21 var WEB_VIEW_ATTRIBUTE_MAXWIDTH = 'maxwidth'; | |
| 22 var WEB_VIEW_ATTRIBUTE_MINHEIGHT = 'minheight'; | |
| 23 var WEB_VIEW_ATTRIBUTE_MINWIDTH = 'minwidth'; | |
| 24 var WEB_VIEW_ATTRIBUTE_PARTITION = 'partition'; | |
| 25 var AUTO_SIZE_ATTRIBUTES = [ | 18 var AUTO_SIZE_ATTRIBUTES = [ |
| 26 WEB_VIEW_ATTRIBUTE_AUTOSIZE, | 19 WebViewConstants.ATTRIBUTE_AUTOSIZE, |
| 27 WEB_VIEW_ATTRIBUTE_MAXHEIGHT, | 20 WebViewConstants.ATTRIBUTE_MAXHEIGHT, |
| 28 WEB_VIEW_ATTRIBUTE_MAXWIDTH, | 21 WebViewConstants.ATTRIBUTE_MAXWIDTH, |
| 29 WEB_VIEW_ATTRIBUTE_MINHEIGHT, | 22 WebViewConstants.ATTRIBUTE_MINHEIGHT, |
| 30 WEB_VIEW_ATTRIBUTE_MINWIDTH | 23 WebViewConstants.ATTRIBUTE_MINWIDTH |
| 31 ]; | 24 ]; |
| 32 | 25 |
| 33 // Error messages. | |
| 34 var ERROR_MSG_ALREADY_NAVIGATED = | |
| 35 'The object has already navigated, so its partition cannot be changed.'; | |
| 36 var ERROR_MSG_CANNOT_INJECT_SCRIPT = '<webview>: ' + | |
| 37 'Script cannot be injected into content until the page has loaded.'; | |
| 38 var ERROR_MSG_CONTENTWINDOW_NOT_AVAILABLE = '<webview>: ' + | |
| 39 'contentWindow is not available at this time. It will become available ' + | |
| 40 'when the page has finished loading.'; | |
| 41 var ERROR_MSG_INVALID_PARTITION_ATTRIBUTE = 'Invalid partition attribute.'; | |
| 42 | |
| 43 // Represents the state of the storage partition. | 26 // Represents the state of the storage partition. |
| 44 function Partition() { | 27 function Partition() { |
| 45 this.validPartitionId = true; | 28 this.validPartitionId = true; |
| 46 this.persistStorage = false; | 29 this.persistStorage = false; |
| 47 this.storagePartitionId = ''; | 30 this.storagePartitionId = ''; |
| 48 } | 31 } |
| 49 | 32 |
| 50 Partition.prototype.toAttribute = function() { | 33 Partition.prototype.toAttribute = function() { |
| 51 if (!this.validPartitionId) { | 34 if (!this.validPartitionId) { |
| 52 return ''; | 35 return ''; |
| 53 } | 36 } |
| 54 return (this.persistStorage ? 'persist:' : '') + this.storagePartitionId; | 37 return (this.persistStorage ? 'persist:' : '') + this.storagePartitionId; |
| 55 }; | 38 }; |
| 56 | 39 |
| 57 Partition.prototype.fromAttribute = function(value, hasNavigated) { | 40 Partition.prototype.fromAttribute = function(value, hasNavigated) { |
| 58 var result = {}; | 41 var result = {}; |
| 59 if (hasNavigated) { | 42 if (hasNavigated) { |
| 60 result.error = ERROR_MSG_ALREADY_NAVIGATED; | 43 result.error = WebViewConstants.ERROR_MSG_ALREADY_NAVIGATED; |
| 61 return result; | 44 return result; |
| 62 } | 45 } |
| 63 if (!value) { | 46 if (!value) { |
| 64 value = ''; | 47 value = ''; |
| 65 } | 48 } |
| 66 | 49 |
| 67 var LEN = 'persist:'.length; | 50 var LEN = 'persist:'.length; |
| 68 if (value.substr(0, LEN) == 'persist:') { | 51 if (value.substr(0, LEN) == 'persist:') { |
| 69 value = value.substr(LEN); | 52 value = value.substr(LEN); |
| 70 if (!value) { | 53 if (!value) { |
| 71 this.validPartitionId = false; | 54 this.validPartitionId = false; |
| 72 result.error = ERROR_MSG_INVALID_PARTITION_ATTRIBUTE; | 55 result.error = WebViewConstants.ERROR_MSG_INVALID_PARTITION_ATTRIBUTE; |
| 73 return result; | 56 return result; |
| 74 } | 57 } |
| 75 this.persistStorage = true; | 58 this.persistStorage = true; |
| 76 } else { | 59 } else { |
| 77 this.persistStorage = false; | 60 this.persistStorage = false; |
| 78 } | 61 } |
| 79 | 62 |
| 80 this.storagePartitionId = value; | 63 this.storagePartitionId = value; |
| 81 return result; | 64 return result; |
| 82 }; | 65 }; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 }.bind(this)); | 156 }.bind(this)); |
| 174 this.webviewNode.addEventListener('blur', function(e) { | 157 this.webviewNode.addEventListener('blur', function(e) { |
| 175 // Blur the BrowserPlugin when the <webview> loses focus. | 158 // Blur the BrowserPlugin when the <webview> loses focus. |
| 176 this.browserPluginNode.blur(); | 159 this.browserPluginNode.blur(); |
| 177 }.bind(this)); | 160 }.bind(this)); |
| 178 }; | 161 }; |
| 179 | 162 |
| 180 // Validation helper function for executeScript() and insertCSS(). | 163 // Validation helper function for executeScript() and insertCSS(). |
| 181 WebView.prototype.validateExecuteCodeCall = function() { | 164 WebView.prototype.validateExecuteCodeCall = function() { |
| 182 if (!this.guestInstanceId) { | 165 if (!this.guestInstanceId) { |
| 183 throw new Error(ERROR_MSG_CANNOT_INJECT_SCRIPT); | 166 throw new Error(WebViewConstants.ERROR_MSG_CANNOT_INJECT_SCRIPT); |
| 184 } | 167 } |
| 185 }; | 168 }; |
| 186 | 169 |
| 187 WebView.prototype.setupAutoSizeProperties = function() { | 170 WebView.prototype.setupAutoSizeProperties = function() { |
| 188 $Array.forEach(AUTO_SIZE_ATTRIBUTES, function(attributeName) { | 171 $Array.forEach(AUTO_SIZE_ATTRIBUTES, function(attributeName) { |
| 189 this[attributeName] = this.webviewNode.getAttribute(attributeName); | 172 this[attributeName] = this.webviewNode.getAttribute(attributeName); |
| 190 Object.defineProperty(this.webviewNode, attributeName, { | 173 Object.defineProperty(this.webviewNode, attributeName, { |
| 191 get: function() { | 174 get: function() { |
| 192 return this[attributeName]; | 175 return this[attributeName]; |
| 193 }.bind(this), | 176 }.bind(this), |
| 194 set: function(value) { | 177 set: function(value) { |
| 195 this.webviewNode.setAttribute(attributeName, value); | 178 this.webviewNode.setAttribute(attributeName, value); |
| 196 }.bind(this), | 179 }.bind(this), |
| 197 enumerable: true | 180 enumerable: true |
| 198 }); | 181 }); |
| 199 }.bind(this), this); | 182 }.bind(this), this); |
| 200 }; | 183 }; |
| 201 | 184 |
| 202 WebView.prototype.setupWebviewNodeProperties = function() { | 185 WebView.prototype.setupWebviewNodeProperties = function() { |
| 203 this.setupAutoSizeProperties(); | 186 this.setupAutoSizeProperties(); |
| 204 | 187 |
| 205 Object.defineProperty(this.webviewNode, | 188 Object.defineProperty(this.webviewNode, |
| 206 WEB_VIEW_ATTRIBUTE_ALLOWTRANSPARENCY, { | 189 WebViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY, { |
| 207 get: function() { | 190 get: function() { |
| 208 return this.allowtransparency; | 191 return this.allowtransparency; |
| 209 }.bind(this), | 192 }.bind(this), |
| 210 set: function(value) { | 193 set: function(value) { |
| 211 this.webviewNode.setAttribute(WEB_VIEW_ATTRIBUTE_ALLOWTRANSPARENCY, | 194 this.webviewNode.setAttribute( |
| 212 value); | 195 WebViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY, |
| 196 value); |
| 213 }.bind(this), | 197 }.bind(this), |
| 214 enumerable: true | 198 enumerable: true |
| 215 }); | 199 }); |
| 216 | 200 |
| 217 // We cannot use {writable: true} property descriptor because we want a | 201 // We cannot use {writable: true} property descriptor because we want a |
| 218 // dynamic getter value. | 202 // dynamic getter value. |
| 219 Object.defineProperty(this.webviewNode, 'contentWindow', { | 203 Object.defineProperty(this.webviewNode, 'contentWindow', { |
| 220 get: function() { | 204 get: function() { |
| 221 if (this.contentWindow) { | 205 if (this.contentWindow) { |
| 222 return this.contentWindow; | 206 return this.contentWindow; |
| 223 } | 207 } |
| 224 window.console.error(ERROR_MSG_CONTENTWINDOW_NOT_AVAILABLE); | 208 window.console.error( |
| 209 WebViewConstants.ERROR_MSG_CONTENTWINDOW_NOT_AVAILABLE); |
| 225 }.bind(this), | 210 }.bind(this), |
| 226 // No setter. | 211 // No setter. |
| 227 enumerable: true | 212 enumerable: true |
| 228 }); | 213 }); |
| 229 | 214 |
| 230 Object.defineProperty(this.webviewNode, 'name', { | 215 Object.defineProperty(this.webviewNode, 'name', { |
| 231 get: function() { | 216 get: function() { |
| 232 return this.name; | 217 return this.name; |
| 233 }.bind(this), | 218 }.bind(this), |
| 234 set: function(value) { | 219 set: function(value) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 // attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more | 280 // attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more |
| 296 // details. | 281 // details. |
| 297 WebView.prototype.handleWebviewAttributeMutation = | 282 WebView.prototype.handleWebviewAttributeMutation = |
| 298 function(name, oldValue, newValue) { | 283 function(name, oldValue, newValue) { |
| 299 if (AUTO_SIZE_ATTRIBUTES.indexOf(name) > -1) { | 284 if (AUTO_SIZE_ATTRIBUTES.indexOf(name) > -1) { |
| 300 this[name] = newValue; | 285 this[name] = newValue; |
| 301 if (!this.guestInstanceId) { | 286 if (!this.guestInstanceId) { |
| 302 return; | 287 return; |
| 303 } | 288 } |
| 304 // Convert autosize attribute to boolean. | 289 // Convert autosize attribute to boolean. |
| 305 var autosize = this.webviewNode.hasAttribute(WEB_VIEW_ATTRIBUTE_AUTOSIZE); | 290 var autosize = this.webviewNode.hasAttribute( |
| 291 WebViewConstants.ATTRIBUTE_AUTOSIZE); |
| 306 GuestViewInternal.setAutoSize(this.guestInstanceId, { | 292 GuestViewInternal.setAutoSize(this.guestInstanceId, { |
| 307 'enableAutoSize': autosize, | 293 'enableAutoSize': autosize, |
| 308 'min': { | 294 'min': { |
| 309 'width': parseInt(this.minwidth || 0), | 295 'width': parseInt(this.minwidth || 0), |
| 310 'height': parseInt(this.minheight || 0) | 296 'height': parseInt(this.minheight || 0) |
| 311 }, | 297 }, |
| 312 'max': { | 298 'max': { |
| 313 'width': parseInt(this.maxwidth || 0), | 299 'width': parseInt(this.maxwidth || 0), |
| 314 'height': parseInt(this.maxheight || 0) | 300 'height': parseInt(this.maxheight || 0) |
| 315 } | 301 } |
| 316 }); | 302 }); |
| 317 return; | 303 return; |
| 318 } else if (name == WEB_VIEW_ATTRIBUTE_ALLOWTRANSPARENCY) { | 304 } else if (name == WebViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY) { |
| 319 // We treat null attribute (attribute removed) and the empty string as | 305 // We treat null attribute (attribute removed) and the empty string as |
| 320 // one case. | 306 // one case. |
| 321 oldValue = oldValue || ''; | 307 oldValue = oldValue || ''; |
| 322 newValue = newValue || ''; | 308 newValue = newValue || ''; |
| 323 | 309 |
| 324 if (oldValue === newValue) { | 310 if (oldValue === newValue) { |
| 325 return; | 311 return; |
| 326 } | 312 } |
| 327 this.allowtransparency = newValue != ''; | 313 this.allowtransparency = newValue != ''; |
| 328 | 314 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 var newHeight = webViewEvent.newHeight; | 398 var newHeight = webViewEvent.newHeight; |
| 413 | 399 |
| 414 var node = this.webviewNode; | 400 var node = this.webviewNode; |
| 415 | 401 |
| 416 var width = node.offsetWidth; | 402 var width = node.offsetWidth; |
| 417 var height = node.offsetHeight; | 403 var height = node.offsetHeight; |
| 418 | 404 |
| 419 // Check the current bounds to make sure we do not resize <webview> | 405 // Check the current bounds to make sure we do not resize <webview> |
| 420 // outside of current constraints. | 406 // outside of current constraints. |
| 421 var maxWidth; | 407 var maxWidth; |
| 422 if (node.hasAttribute(WEB_VIEW_ATTRIBUTE_MAXWIDTH) && | 408 if (node.hasAttribute(WebViewConstants.ATTRIBUTE_MAXWIDTH) && |
| 423 node[WEB_VIEW_ATTRIBUTE_MAXWIDTH]) { | 409 node[WebViewConstants.ATTRIBUTE_MAXWIDTH]) { |
| 424 maxWidth = node[WEB_VIEW_ATTRIBUTE_MAXWIDTH]; | 410 maxWidth = node[WebViewConstants.ATTRIBUTE_MAXWIDTH]; |
| 425 } else { | 411 } else { |
| 426 maxWidth = width; | 412 maxWidth = width; |
| 427 } | 413 } |
| 428 | 414 |
| 429 var minWidth; | 415 var minWidth; |
| 430 if (node.hasAttribute(WEB_VIEW_ATTRIBUTE_MINWIDTH) && | 416 if (node.hasAttribute(WebViewConstants.ATTRIBUTE_MINWIDTH) && |
| 431 node[WEB_VIEW_ATTRIBUTE_MINWIDTH]) { | 417 node[WebViewConstants.ATTRIBUTE_MINWIDTH]) { |
| 432 minWidth = node[WEB_VIEW_ATTRIBUTE_MINWIDTH]; | 418 minWidth = node[WebViewConstants.ATTRIBUTE_MINWIDTH]; |
| 433 } else { | 419 } else { |
| 434 minWidth = width; | 420 minWidth = width; |
| 435 } | 421 } |
| 436 if (minWidth > maxWidth) { | 422 if (minWidth > maxWidth) { |
| 437 minWidth = maxWidth; | 423 minWidth = maxWidth; |
| 438 } | 424 } |
| 439 | 425 |
| 440 var maxHeight; | 426 var maxHeight; |
| 441 if (node.hasAttribute(WEB_VIEW_ATTRIBUTE_MAXHEIGHT) && | 427 if (node.hasAttribute(WebViewConstants.ATTRIBUTE_MAXHEIGHT) && |
| 442 node[WEB_VIEW_ATTRIBUTE_MAXHEIGHT]) { | 428 node[WebViewConstants.ATTRIBUTE_MAXHEIGHT]) { |
| 443 maxHeight = node[WEB_VIEW_ATTRIBUTE_MAXHEIGHT]; | 429 maxHeight = node[WebViewConstants.ATTRIBUTE_MAXHEIGHT]; |
| 444 } else { | 430 } else { |
| 445 maxHeight = height; | 431 maxHeight = height; |
| 446 } | 432 } |
| 447 | 433 |
| 448 var minHeight; | 434 var minHeight; |
| 449 if (node.hasAttribute(WEB_VIEW_ATTRIBUTE_MINHEIGHT) && | 435 if (node.hasAttribute(WebViewConstants.ATTRIBUTE_MINHEIGHT) && |
| 450 node[WEB_VIEW_ATTRIBUTE_MINHEIGHT]) { | 436 node[WebViewConstants.ATTRIBUTE_MINHEIGHT]) { |
| 451 minHeight = node[WEB_VIEW_ATTRIBUTE_MINHEIGHT]; | 437 minHeight = node[WebViewConstants.ATTRIBUTE_MINHEIGHT]; |
| 452 } else { | 438 } else { |
| 453 minHeight = height; | 439 minHeight = height; |
| 454 } | 440 } |
| 455 if (minHeight > maxHeight) { | 441 if (minHeight > maxHeight) { |
| 456 minHeight = maxHeight; | 442 minHeight = maxHeight; |
| 457 } | 443 } |
| 458 | 444 |
| 459 if (!this.webviewNode.hasAttribute(WEB_VIEW_ATTRIBUTE_AUTOSIZE) || | 445 if (!this.webviewNode.hasAttribute(WebViewConstants.ATTRIBUTE_AUTOSIZE) || |
| 460 (newWidth >= minWidth && | 446 (newWidth >= minWidth && |
| 461 newWidth <= maxWidth && | 447 newWidth <= maxWidth && |
| 462 newHeight >= minHeight && | 448 newHeight >= minHeight && |
| 463 newHeight <= maxHeight)) { | 449 newHeight <= maxHeight)) { |
| 464 node.style.width = newWidth + 'px'; | 450 node.style.width = newWidth + 'px'; |
| 465 node.style.height = newHeight + 'px'; | 451 node.style.height = newHeight + 'px'; |
| 466 // Only fire the DOM event if the size of the <webview> has actually | 452 // Only fire the DOM event if the size of the <webview> has actually |
| 467 // changed. | 453 // changed. |
| 468 this.dispatchEvent(webViewEvent); | 454 this.dispatchEvent(webViewEvent); |
| 469 } | 455 } |
| 470 }; | 456 }; |
| 471 | 457 |
| 472 // Returns if <object> is in the render tree. | 458 // Returns if <object> is in the render tree. |
| 473 WebView.prototype.isPluginInRenderTree = function() { | 459 WebView.prototype.isPluginInRenderTree = function() { |
| 474 return !!this.internalInstanceId && this.internalInstanceId != 0; | 460 return !!this.internalInstanceId && this.internalInstanceId != 0; |
| 475 }; | 461 }; |
| 476 | 462 |
| 477 WebView.prototype.hasNavigated = function() { | 463 WebView.prototype.hasNavigated = function() { |
| 478 return !this.beforeFirstNavigation; | 464 return !this.beforeFirstNavigation; |
| 479 }; | 465 }; |
| 480 | 466 |
| 481 WebView.prototype.parseSrcAttribute = function(result) { | 467 WebView.prototype.parseSrcAttribute = function(result) { |
| 482 if (!this.partition.validPartitionId) { | 468 if (!this.partition.validPartitionId) { |
| 483 result.error = ERROR_MSG_INVALID_PARTITION_ATTRIBUTE; | 469 result.error = WebViewConstants.ERROR_MSG_INVALID_PARTITION_ATTRIBUTE; |
| 484 return; | 470 return; |
| 485 } | 471 } |
| 486 this.src = this.webviewNode.getAttribute('src'); | 472 this.src = this.webviewNode.getAttribute('src'); |
| 487 | 473 |
| 488 if (!this.src) { | 474 if (!this.src) { |
| 489 return; | 475 return; |
| 490 } | 476 } |
| 491 | 477 |
| 492 if (this.guestInstanceId == undefined) { | 478 if (this.guestInstanceId == undefined) { |
| 493 if (this.beforeFirstNavigation) { | 479 if (this.beforeFirstNavigation) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 509 var attributeValue = this.webviewNode.getAttribute('partition'); | 495 var attributeValue = this.webviewNode.getAttribute('partition'); |
| 510 var result = this.partition.fromAttribute(attributeValue, hasNavigated); | 496 var result = this.partition.fromAttribute(attributeValue, hasNavigated); |
| 511 this.parseSrcAttribute(result); | 497 this.parseSrcAttribute(result); |
| 512 }; | 498 }; |
| 513 | 499 |
| 514 WebView.prototype.createGuest = function() { | 500 WebView.prototype.createGuest = function() { |
| 515 if (this.pendingGuestCreation) { | 501 if (this.pendingGuestCreation) { |
| 516 return; | 502 return; |
| 517 } | 503 } |
| 518 var storagePartitionId = | 504 var storagePartitionId = |
| 519 this.webviewNode.getAttribute(WEB_VIEW_ATTRIBUTE_PARTITION) || | 505 this.webviewNode.getAttribute(WebViewConstants.ATTRIBUTE_PARTITION) || |
| 520 this.webviewNode[WEB_VIEW_ATTRIBUTE_PARTITION]; | 506 this.webviewNode[WebViewConstants.ATTRIBUTE_PARTITION]; |
| 521 var params = { | 507 var params = { |
| 522 'storagePartitionId': storagePartitionId | 508 'storagePartitionId': storagePartitionId |
| 523 }; | 509 }; |
| 524 GuestViewInternal.createGuest( | 510 GuestViewInternal.createGuest( |
| 525 'webview', | 511 'webview', |
| 526 params, | 512 params, |
| 527 function(guestInstanceId) { | 513 function(guestInstanceId) { |
| 528 this.pendingGuestCreation = false; | 514 this.pendingGuestCreation = false; |
| 529 if (!this.elementAttached) { | 515 if (!this.elementAttached) { |
| 530 GuestViewInternal.destroyGuest(guestInstanceId); | 516 GuestViewInternal.destroyGuest(guestInstanceId); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 }; | 574 }; |
| 589 | 575 |
| 590 WebView.prototype.onAttach = function(storagePartitionId) { | 576 WebView.prototype.onAttach = function(storagePartitionId) { |
| 591 this.webviewNode.setAttribute('partition', storagePartitionId); | 577 this.webviewNode.setAttribute('partition', storagePartitionId); |
| 592 this.partition.fromAttribute(storagePartitionId, this.hasNavigated()); | 578 this.partition.fromAttribute(storagePartitionId, this.hasNavigated()); |
| 593 }; | 579 }; |
| 594 | 580 |
| 595 WebView.prototype.buildAttachParams = function(isNewWindow) { | 581 WebView.prototype.buildAttachParams = function(isNewWindow) { |
| 596 var params = { | 582 var params = { |
| 597 'allowtransparency': this.allowtransparency || false, | 583 'allowtransparency': this.allowtransparency || false, |
| 598 'autosize': this.webviewNode.hasAttribute(WEB_VIEW_ATTRIBUTE_AUTOSIZE), | 584 'autosize': this.webviewNode.hasAttribute( |
| 585 WebViewConstants.ATTRIBUTE_AUTOSIZE), |
| 599 'instanceId': this.viewInstanceId, | 586 'instanceId': this.viewInstanceId, |
| 600 'maxheight': parseInt(this.maxheight || 0), | 587 'maxheight': parseInt(this.maxheight || 0), |
| 601 'maxwidth': parseInt(this.maxwidth || 0), | 588 'maxwidth': parseInt(this.maxwidth || 0), |
| 602 'minheight': parseInt(this.minheight || 0), | 589 'minheight': parseInt(this.minheight || 0), |
| 603 'minwidth': parseInt(this.minwidth || 0), | 590 'minwidth': parseInt(this.minwidth || 0), |
| 604 'name': this.name, | 591 'name': this.name, |
| 605 // We don't need to navigate new window from here. | 592 // We don't need to navigate new window from here. |
| 606 'src': isNewWindow ? undefined : this.src, | 593 'src': isNewWindow ? undefined : this.src, |
| 607 // If we have a partition from the opener, that will also be already | 594 // If we have a partition from the opener, that will also be already |
| 608 // set via this.onAttach(). | 595 // set via this.onAttach(). |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 WebView.prototype.maybeGetChromeWebViewEvents = function() {}; | 913 WebView.prototype.maybeGetChromeWebViewEvents = function() {}; |
| 927 | 914 |
| 928 // Implemented when the experimental WebView API is available. | 915 // Implemented when the experimental WebView API is available. |
| 929 WebView.maybeGetExperimentalAPIs = function() {}; | 916 WebView.maybeGetExperimentalAPIs = function() {}; |
| 930 WebView.prototype.maybeGetExperimentalEvents = function() {}; | 917 WebView.prototype.maybeGetExperimentalEvents = function() {}; |
| 931 WebView.prototype.setupExperimentalContextMenus = function() {}; | 918 WebView.prototype.setupExperimentalContextMenus = function() {}; |
| 932 | 919 |
| 933 // Exports. | 920 // Exports. |
| 934 exports.WebView = WebView; | 921 exports.WebView = WebView; |
| 935 exports.WebViewInternal = WebViewInternal; | 922 exports.WebViewInternal = WebViewInternal; |
| OLD | NEW |