| Index: chrome/renderer/resources/extensions/web_view_old.js
|
| diff --git a/chrome/renderer/resources/extensions/browser_tag_old.js b/chrome/renderer/resources/extensions/web_view_old.js
|
| similarity index 69%
|
| rename from chrome/renderer/resources/extensions/browser_tag_old.js
|
| rename to chrome/renderer/resources/extensions/web_view_old.js
|
| index bd0b8bd11d8c9af628ae468b6bedce7dd8e8057f..411d046f7aa19899b44f4a47f6856e092448c3e1 100644
|
| --- a/chrome/renderer/resources/extensions/browser_tag_old.js
|
| +++ b/chrome/renderer/resources/extensions/web_view_old.js
|
| @@ -2,26 +2,26 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// Shim that simulates a <browser> tag via Mutation Observers.
|
| +// Shim that simulates a <webview> tag via Mutation Observers.
|
| //
|
| // The actual tag is implemented via the browser plugin. The internals of this
|
| // are hidden via Shadow DOM.
|
|
|
| -var BROWSER_TAG_ATTRIBUTES = ['src', 'width', 'height'];
|
| +var WEB_VIEW_ATTRIBUTES = ['src', 'width', 'height'];
|
|
|
| window.addEventListener('DOMContentLoaded', function() {
|
| - // Handle <browser> tags already in the document.
|
| - var browserNodes = document.body.querySelectorAll('browser');
|
| - for (var i = 0, browserNode; browserNode = browserNodes[i]; i++) {
|
| - new BrowserTag(browserNode);
|
| + // Handle <webview> tags already in the document.
|
| + var webViewNodes = document.body.querySelectorAll('webview');
|
| + for (var i = 0, webViewNode; webViewNode = webViewNodes[i]; i++) {
|
| + new WebView(webViewNode);
|
| }
|
|
|
| - // Handle <browser> tags added later.
|
| + // Handle <webview> tags added later.
|
| var documentObserver = new WebKitMutationObserver(function(mutations) {
|
| mutations.forEach(function(mutation) {
|
| for (var i = 0, addedNode; addedNode = mutation.addedNodes[i]; i++) {
|
| - if (addedNode.tagName == 'BROWSER') {
|
| - new BrowserTag(addedNode);
|
| + if (addedNode.tagName == 'WEBVIEW') {
|
| + new WebView(addedNode);
|
| }
|
| }
|
| });
|
| @@ -32,16 +32,16 @@ window.addEventListener('DOMContentLoaded', function() {
|
| /**
|
| * @constructor
|
| */
|
| -function BrowserTag(node) {
|
| +function WebView(node) {
|
| this.node_ = node;
|
| var shadowRoot = new WebKitShadowRoot(node);
|
|
|
| this.objectNode_ = document.createElement('object');
|
| this.objectNode_.type = 'application/browser-plugin';
|
| - BROWSER_TAG_ATTRIBUTES.forEach(this.copyAttribute_, this);
|
| + WEB_VIEW_ATTRIBUTES.forEach(this.copyAttribute_, this);
|
| shadowRoot.appendChild(this.objectNode_);
|
|
|
| - // Map attribute modifications on the <browser> tag to changes on the
|
| + // Map attribute modifications on the <webview> tag to changes on the
|
| // underlying <object> node.
|
| var handleMutation = this.handleMutation_.bind(this);
|
| var observer = new WebKitMutationObserver(function(mutations) {
|
| @@ -49,10 +49,10 @@ function BrowserTag(node) {
|
| });
|
| observer.observe(
|
| this.node_,
|
| - {attributes: true, attributeFilter: BROWSER_TAG_ATTRIBUTES});
|
| + {attributes: true, attributeFilter: WEB_VIEW_ATTRIBUTES});
|
|
|
| // Expose getters and setters for the attributes.
|
| - BROWSER_TAG_ATTRIBUTES.forEach(function(attributeName) {
|
| + WEB_VIEW_ATTRIBUTES.forEach(function(attributeName) {
|
| Object.defineProperty(this.node_, attributeName, {
|
| get: function() {
|
| var value = node.getAttribute(attributeName);
|
| @@ -70,7 +70,7 @@ function BrowserTag(node) {
|
| /**
|
| * @private
|
| */
|
| -BrowserTag.prototype.handleMutation_ = function(mutation) {
|
| +WebView.prototype.handleMutation_ = function(mutation) {
|
| switch (mutation.attributeName) {
|
| case 'src':
|
| this.objectNode_.postMessage(this.node_.getAttribute('src'));
|
| @@ -84,7 +84,7 @@ BrowserTag.prototype.handleMutation_ = function(mutation) {
|
| /**
|
| * @private
|
| */
|
| -BrowserTag.prototype.copyAttribute_ = function(attributeName) {
|
| +WebView.prototype.copyAttribute_ = function(attributeName) {
|
| this.objectNode_.setAttribute(
|
| attributeName, this.node_.getAttribute(attributeName));
|
| };
|
|
|