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

Unified Diff: ui/file_manager/file_manager/background/js/file_operation_util.js

Issue 2949513006: Show number of remaining files when copying directories. (Closed)
Patch Set: 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/background/js/file_operation_util.js
diff --git a/ui/file_manager/file_manager/background/js/file_operation_util.js b/ui/file_manager/file_manager/background/js/file_operation_util.js
index 73bb7268651baf18e607a82adb79fbd255e18461..2db0aea30b991f5a253a6c4cd26adaa301755e59 100644
--- a/ui/file_manager/file_manager/background/js/file_operation_util.js
+++ b/ui/file_manager/file_manager/background/js/file_operation_util.js
@@ -612,14 +612,34 @@ fileOperationUtil.Task.prototype.run = function(
/**
* Get states of the task.
- * TOOD(hirono): Removes this method and sets a task to progress events.
+ * TODO(hirono): Removes this method and sets a task to progress events.
* @return {Object} Status object.
*/
fileOperationUtil.Task.prototype.getStatus = function() {
var processingEntry = this.sourceEntries[this.processingSourceIndex_];
+ var numRemainingItems = 0;
+
+ var resolvedEntryMap;
+ if (this.processingEntries && this.processingEntries.length > 0)
+ resolvedEntryMap = this.processingEntries[this.processingSourceIndex_];
+
+ if (resolvedEntryMap) {
+ for (var key in resolvedEntryMap) {
fukino 2017/06/26 05:15:15 not lgtm, since this changes asymptotic time compl
tetsui 2017/06/26 06:51:20 Done.
+ if (resolvedEntryMap.hasOwnProperty(key) &&
+ resolvedEntryMap[key].processedBytes === 0) {
+ numRemainingItems++;
+ }
+ }
+ for (var i = this.processingSourceIndex_ + 1;
+ i < this.processingEntries.length; i++) {
+ numRemainingItems += Object.keys(this.processingEntries[i] || {}).length;
+ }
+ } else {
+ numRemainingItems = this.sourceEntries.length - this.processingSourceIndex_;
+ }
return {
operationType: this.operationType,
- numRemainingItems: this.sourceEntries.length - this.processingSourceIndex_,
+ numRemainingItems: numRemainingItems,
totalBytes: this.totalBytes,
processedBytes: this.processedBytes,
processingEntryName: processingEntry ? processingEntry.name : ''
« 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