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

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

Issue 2607443002: Count and report number of duplicated files found during import. (Closed)
Patch Set: Fix indent. Created 3 years, 11 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/media_import_handler.js
diff --git a/ui/file_manager/file_manager/background/js/media_import_handler.js b/ui/file_manager/file_manager/background/js/media_import_handler.js
index 66d708735ed82917a6961313da72307528f9ad1e..550b17ed831013a9363963050f7c465bd9c24455 100644
--- a/ui/file_manager/file_manager/background/js/media_import_handler.js
+++ b/ui/file_manager/file_manager/background/js/media_import_handler.js
@@ -235,6 +235,11 @@ importer.MediaImportHandler.ImportTask = function(
/** @private {number} */
this.processedBytes_ = 0;
+ /**
+ * Number of duplicate files found by the content hash check.
+ * @private {number} */
+ this.duplicateFilesCount_ = 0;
+
/** @private {number} */
this.remainingFilesCount_ = 0;
@@ -401,6 +406,7 @@ importer.MediaImportHandler.ImportTask.prototype.importOne_ =
if (disposition === importer.Disposition.ORIGINAL) {
return this.copy_(entry, destinationDirectory);
}
+ this.duplicateFilesCount_++;
this.markAsImported_(entry);
}.bind(this))
// Regardless of the result of this copy, push on to the next file.
@@ -581,6 +587,11 @@ importer.MediaImportHandler.ImportTask.prototype.sendImportStats_ =
// Finally we want to report on the number of duplicates
// that were identified during scanning.
var totalDeduped = 0;
+ // The scan is run without content duplicate check.
+ // Instead, report the number of duplicated files found at import.
+ assert(scanStats.duplicates[importer.Disposition.CONTENT_DUPLICATE] === 0);
+ scanStats.duplicates[importer.Disposition.CONTENT_DUPLICATE] =
+ this.duplicateFilesCount_;
Object.keys(scanStats.duplicates).forEach(
/**
* @param {!importer.Disposition} disposition
« 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