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 : '' |