Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(611)

Unified Diff: extensions/renderer/resources/guest_view/web_view.js

Issue 706473002: Automated the definitions of webview attributes as properties on the webview node. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | extensions/renderer/resources/guest_view/web_view_attributes.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/guest_view/web_view.js
diff --git a/extensions/renderer/resources/guest_view/web_view.js b/extensions/renderer/resources/guest_view/web_view.js
index 31f4b531d2bc5dcb027622f01bc8a5544fab70da..958f97a9158b36f1a3fbd8cb01214511d96c95ab 100644
--- a/extensions/renderer/resources/guest_view/web_view.js
+++ b/extensions/renderer/resources/guest_view/web_view.js
@@ -125,35 +125,10 @@ WebView.prototype.validateExecuteCodeCall = function() {
}
};
-WebView.prototype.setupAutoSizeProperties = function() {
- $Array.forEach(AUTO_SIZE_ATTRIBUTES, function(attributeName) {
- Object.defineProperty(this.webviewNode, attributeName, {
- get: function() {
- return this.attributes[attributeName].getValue();
- }.bind(this),
- set: function(value) {
- this.attributes[attributeName].setValue(value);
- }.bind(this),
- enumerable: true
- });
- }.bind(this), this);
-};
-
WebView.prototype.setupWebviewNodeProperties = function() {
- this.setupAutoSizeProperties();
-
- Object.defineProperty(this.webviewNode,
- WebViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY, {
- get: function() {
- return this.attributes[WebViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY].
- getValue();
- }.bind(this),
- set: function(value) {
- this.attributes[WebViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY].
- setValue(value);
- }.bind(this),
- enumerable: true
- });
+ for (var attributeName in this.attributes) {
+ this.attributes[attributeName].define();
+ }
// We cannot use {writable: true} property descriptor because we want a
// dynamic getter value.
@@ -168,37 +143,6 @@ WebView.prototype.setupWebviewNodeProperties = function() {
// No setter.
enumerable: true
});
-
- Object.defineProperty(this.webviewNode, WebViewConstants.ATTRIBUTE_NAME, {
- get: function() {
- return this.attributes[WebViewConstants.ATTRIBUTE_NAME].getValue();
- }.bind(this),
- set: function(value) {
- this.attributes[WebViewConstants.ATTRIBUTE_NAME].setValue(value);
- }.bind(this),
- enumerable: true
- });
-
- Object.defineProperty(this.webviewNode,
- WebViewConstants.ATTRIBUTE_PARTITION, {
- get: function() {
- return this.attributes[WebViewConstants.ATTRIBUTE_PARTITION].getValue();
- }.bind(this),
- set: function(value) {
- this.attributes[WebViewConstants.ATTRIBUTE_PARTITION].setValue(value);
- }.bind(this),
- enumerable: true
- });
-
- Object.defineProperty(this.webviewNode, WebViewConstants.ATTRIBUTE_SRC, {
- get: function() {
- return this.attributes[WebViewConstants.ATTRIBUTE_SRC].getValue();
- }.bind(this),
- set: function(value) {
- this.attributes[WebViewConstants.ATTRIBUTE_SRC].setValue(value);
- }.bind(this),
- enumerable: true
- });
};
// The purpose of this mutation observer is to catch assignment to the src
« no previous file with comments | « no previous file | extensions/renderer/resources/guest_view/web_view_attributes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698