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

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

Issue 1375333004: MD Downloads: use <iron-list> to render download items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iron-list2
Patch Set: nit 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
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 a750e61a193a6ca7a9bd0b89910d42665c48d33a..ce2a0c871b2569ed85faa62eae15fda4d568bb01 100644
--- a/chrome/browser/resources/md_downloads/item.js
+++ b/chrome/browser/resources/md_downloads/item.js
@@ -6,14 +6,6 @@ cr.define('downloads', function() {
var Item = Polymer({
is: 'downloads-item',
- /**
- * @param {!downloads.ThrottledIconLoader} iconLoader
- */
- factoryImpl: function(iconLoader) {
- /** @private {!downloads.ThrottledIconLoader} */
Dan Beam 2015/10/02 05:37:06 will remove this class fully separately
- this.iconLoader_ = iconLoader;
- },
-
properties: {
data: {
type: Object,
@@ -24,15 +16,6 @@ cr.define('downloads', function() {
value: true,
},
- readyPromise: {
Dan Beam 2015/10/02 05:37:06 wasn't needed
- type: Object,
- value: function() {
- return new Promise(function(resolve, reject) {
- this.resolveReadyPromise_ = resolve;
- }.bind(this));
- },
- },
-
completelyOnDisk_: {
computed: 'computeCompletelyOnDisk_(' +
'data.state, data.file_externally_removed)',
@@ -105,21 +88,11 @@ cr.define('downloads', function() {
// TODO(dbeam): this gets called way more when I observe data.by_ext_id
// and data.by_ext_name directly. Why?
'observeControlledBy_(controlledBy_)',
+ 'observeIsDangerous_(isDangerous_, data.file_path)',
],
ready: function() {
this.content = this.$.content;
- this.resolveReadyPromise_();
- },
-
- /** @param {!downloads.Data} data */
- update: function(data) {
- this.data = data;
-
- if (!this.isDangerous_) {
- var icon = 'chrome://fileicon/' + encodeURIComponent(data.file_path);
- this.iconLoader_.loadScaledIcon(this.$['file-icon'], icon);
- }
},
/** @private */
@@ -263,6 +236,14 @@ cr.define('downloads', function() {
},
/** @private */
+ observeIsDangerous_: function() {
+ if (this.data && !this.isDangerous_) {
+ var filePath = encodeURIComponent(this.data.file_path);
+ this.$['file-icon'].src = 'chrome://fileicon/' + filePath;
+ }
+ },
+
+ /** @private */
onCancelClick_: function() {
downloads.ActionService.getInstance().cancel(this.data.id);
},

Powered by Google App Engine
This is Rietveld 408576698