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

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

Issue 2154033002: MD Downloads: fix focus issue on downloads page by combining pause/play (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge + re-vulcanize Created 4 years, 5 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 038623c8fedffaf1f76a860c95c20aeb24105f8f..7087a50079559028b58aac4564084752ea62a835 100644
--- a/chrome/browser/resources/md_downloads/item.js
+++ b/chrome/browser/resources/md_downloads/item.js
@@ -37,12 +37,23 @@ cr.define('downloads', function() {
value: false,
},
+ isMalware_: {
+ computed: 'computeIsMalware_(isDangerous_, data.danger_type)',
+ type: Boolean,
+ value: false,
+ },
+
isInProgress_: {
computed: 'computeIsInProgress_(data.state)',
type: Boolean,
value: false,
},
+ pauseOrResumeText_: {
+ computed: 'computePauseOrResumeText_(isInProgress_, data.resume)',
+ type: String,
+ },
+
showCancel_: {
computed: 'computeShowCancel_(data.state)',
type: Boolean,
@@ -54,12 +65,6 @@ cr.define('downloads', function() {
type: Boolean,
value: false,
},
-
- isMalware_: {
- computed: 'computeIsMalware_(isDangerous_, data.danger_type)',
- type: Boolean,
- value: false,
- },
},
observers: [
@@ -187,6 +192,15 @@ cr.define('downloads', function() {
},
/** @private */
+ computePauseOrResumeText_: function() {
+ if (this.isInProgress_)
+ return loadTimeData.getString('controlPause');
+ if (this.data.resume)
+ return loadTimeData.getString('controlResume');
+ return '';
+ },
+
+ /** @private */
computeRemoveStyle_: function() {
var canDelete = loadTimeData.getBoolean('allowDeletingHistory');
var hideRemove = this.isDangerous_ || this.showCancel_ || !canDelete;
@@ -275,8 +289,11 @@ cr.define('downloads', function() {
},
/** @private */
- onPauseTap_: function() {
- downloads.ActionService.getInstance().pause(this.data.id);
+ onPauseOrResumeTap_: function() {
+ if (this.isInProgress_)
+ downloads.ActionService.getInstance().pause(this.data.id);
+ else
+ downloads.ActionService.getInstance().resume(this.data.id);
},
/** @private */
@@ -285,11 +302,6 @@ cr.define('downloads', function() {
},
/** @private */
- onResumeTap_: function() {
- downloads.ActionService.getInstance().resume(this.data.id);
- },
-
- /** @private */
onRetryTap_: function() {
downloads.ActionService.getInstance().download(this.data.url);
},

Powered by Google App Engine
This is Rietveld 408576698