| 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 706436de77ccc5b7b9d1a7eebe00000f6e7bacca..2f43efc43bf71648aad800d370f95a55398659e6 100644
|
| --- a/chrome/browser/resources/md_downloads/item.js
|
| +++ b/chrome/browser/resources/md_downloads/item.js
|
| @@ -158,20 +158,13 @@ cr.define('downloads', function() {
|
|
|
| this.$.content.classList.toggle('show-progress', this.showProgress_);
|
|
|
| - var hideRemove;
|
| -
|
| - if (this.isDangerous_) {
|
| - hideRemove = true;
|
| - } else {
|
| + if (!this.isDangerous_) {
|
| this.$['file-link'].href = data.url;
|
| this.ensureTextIs_(this.$['file-link'], data.file_name);
|
|
|
| this.$['file-link'].hidden = !this.completelyOnDisk_;
|
| this.$.name.hidden = this.completelyOnDisk_;
|
|
|
| - hideRemove = this.showCancel_ ||
|
| - !loadTimeData.getBoolean('allowDeletingHistory');
|
| -
|
| /** @const */ var controlledByExtension = data.by_ext_id &&
|
| data.by_ext_name;
|
| this.$['controlled-by'].hidden = !controlledByExtension;
|
| @@ -184,8 +177,6 @@ cr.define('downloads', function() {
|
| var icon = 'chrome://fileicon/' + encodeURIComponent(data.file_path);
|
| this.iconLoader_.loadScaledIcon(this.$['file-icon'], icon);
|
| }
|
| -
|
| - this.$.remove.style.visibility = hideRemove ? 'hidden' : '';
|
| },
|
|
|
| /** @private */
|
| @@ -220,6 +211,13 @@ cr.define('downloads', function() {
|
| },
|
|
|
| /** @private */
|
| + computeRemoveStyle_: function() {
|
| + var canDelete = loadTimeData.getBoolean('allowDeletingHistory');
|
| + var hideRemove = this.isDangerous_ || this.showCancel_ || !canDelete;
|
| + return hideRemove ? 'visibility: hidden' : '';
|
| + },
|
| +
|
| + /** @private */
|
| computeShowCancel_: function() {
|
| return this.data_.state == downloads.States.IN_PROGRESS ||
|
| this.data_.state == downloads.States.PAUSED;
|
| @@ -302,6 +300,11 @@ cr.define('downloads', function() {
|
| this.actionService_.cancel(this.data_.id);
|
| },
|
|
|
| + /** @private */
|
| + onDiscardDangerous_: function() {
|
| + this.actionService_.discardDangerous(this.data_.id);
|
| + },
|
| +
|
| /**
|
| * @private
|
| * @param {Event} e
|
| @@ -327,21 +330,10 @@ cr.define('downloads', function() {
|
|
|
| /** @private */
|
| onRemoveClick_: function() {
|
| - assert(!this.$.remove.disabled);
|
| this.actionService_.remove(this.data_.id);
|
| },
|
|
|
| /** @private */
|
| - onSaveDangerous_: function() {
|
| - this.actionService_.saveDangerous(this.data_.id);
|
| - },
|
| -
|
| - /** @private */
|
| - onDiscardDangerous_: function() {
|
| - this.actionService_.discardDangerous(this.data_.id);
|
| - },
|
| -
|
| - /** @private */
|
| onResumeClick_: function() {
|
| this.actionService_.resume(this.data_.id);
|
| },
|
| @@ -352,6 +344,11 @@ cr.define('downloads', function() {
|
| },
|
|
|
| /** @private */
|
| + onSaveDangerous_: function() {
|
| + this.actionService_.saveDangerous(this.data_.id);
|
| + },
|
| +
|
| + /** @private */
|
| onScrollbarWidthChange_: function() {
|
| if (!this.$)
|
| return;
|
|
|