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

Unified Diff: ui/file_manager/file_manager/foreground/js/file_transfer_controller.js

Issue 2923953002: Remove early progress center item when no files are copied. (Closed)
Patch Set: Rebased. Created 3 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
index 7d8bed05c65b3aba998c0d1c0ff676b072383775..44681b0f7baf53d45355c9b1036c72deb5c3fd2d 100644
--- a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
@@ -529,6 +529,7 @@ FileTransferController.prototype.paste =
var shareEntries;
var taskId = this.fileOperationManager_.generateTaskId();
+ // Creates early progress center item for faster user feedback.
var item = new ProgressCenterItem();
item.id = taskId;
if (toMove) {
@@ -546,6 +547,8 @@ FileTransferController.prototype.paste =
*/
function(result) {
failureUrls = result.failureUrls;
+ // The promise is not rejected, so it's safe to not remove the early
+ // progress center item here.
return this.fileOperationManager_.filterSameDirectoryEntry(
result.entries, destinationEntry, toMove);
}.bind(this))
@@ -557,8 +560,14 @@ FileTransferController.prototype.paste =
*/
function(filteredEntries) {
entries = filteredEntries;
- if (entries.length === 0)
+ if (entries.length === 0) {
+ // Remove the early progress center item.
+ var item = new ProgressCenterItem();
+ item.id = taskId;
+ item.state = ProgressItemState.CANCELED;
+ this.progressCenter_.updateItem(item);
return Promise.reject('ABORT');
+ }
this.pendingTaskIds.push(taskId);
var item = new ProgressCenterItem();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698