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

Unified Diff: chrome/browser/resources/md_downloads/item.js

Issue 1305063012: MD Downloads: compute content classes via data binding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dom-if4
Patch Set: Created 5 years, 3 months 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 | « chrome/browser/resources/md_downloads/item.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_downloads/item.js
diff --git a/chrome/browser/resources/md_downloads/item.js b/chrome/browser/resources/md_downloads/item.js
index 032776e06bf9e64c49bda4eabf0e2f267e6ac1b0..2ad8d317722a96eae58a06037166b0e284ce6058 100644
--- a/chrome/browser/resources/md_downloads/item.js
+++ b/chrome/browser/resources/md_downloads/item.js
@@ -147,11 +147,6 @@ cr.define('downloads', function() {
this.set('data_.' + key, data[key]);
}
- // TODO(dbeam): Move to a computeClass_() method + data binding.
- this.$.content.classList.toggle('is-active', this.isActive_);
- this.$.content.classList.toggle('dangerous', this.isDangerous_);
- this.$.content.classList.toggle('show-progress', this.showProgress_);
-
var desc = this.getDangerText_(data) || this.getStatusText_(data);
// Status goes in the "tag" (next to the file name) if there's no file.
@@ -174,6 +169,22 @@ cr.define('downloads', function() {
},
/** @private */
+ computeClass_: function() {
+ var classes = [];
+
+ if (this.isActive_)
+ classes.push('is-active');
+
+ if (this.isDangerous_)
+ classes.push('dangerous');
+
+ if (this.showProgress_)
+ classes.push('show-progress');
+
+ return classes.join(' ');
+ },
+
+ /** @private */
computeCompletelyOnDisk_: function() {
return this.data_.state == downloads.States.COMPLETE &&
!this.data_.file_externally_removed;
« no previous file with comments | « chrome/browser/resources/md_downloads/item.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698