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

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

Issue 542573002: Make onFileTransferUpdated single value from list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « ui/file_manager/file_manager/background/js/drive_sync_handler.js ('k') | 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_manager.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js
index 7ca5611b8c2bc898bda5fb5334d95bb1f5b982ea..2b085820892260eef9becca32167a25f5d738a2c 100644
--- a/ui/file_manager/file_manager/foreground/js/file_manager.js
+++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -3026,23 +3026,17 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
var bytesTotal = 0;
var bytesDone = 0;
- var onFileTransfersUpdated = function(statusList) {
- for (var index = 0; index < statusList.length; index++) {
- var status = statusList[index];
- var escaped = encodeURI(status.fileUrl);
- if (!(escaped in progressMap)) continue;
- if (status.total == -1) continue;
-
- var old = progressMap[escaped];
- if (old == -1) {
- // -1 means we don't know file size yet.
- bytesTotal += status.total;
- filesStarted++;
- old = 0;
- }
- bytesDone += status.processed - old;
- progressMap[escaped] = status.processed;
+ var onFileTransfersUpdated = function(status) {
+ var escaped = encodeURI(status.fileUrl);
+ var old = progressMap[escaped];
+ if (old == -1) {
+ // -1 means we don't know file size yet.
+ bytesTotal += status.total;
+ filesStarted++;
+ old = 0;
}
+ bytesDone += status.processed - old;
+ progressMap[escaped] = status.processed;
var percent = bytesTotal == 0 ? 0 : bytesDone / bytesTotal;
// For files we don't have information about, assume the progress is zero.
« no previous file with comments | « ui/file_manager/file_manager/background/js/drive_sync_handler.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698