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

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

Issue 2569163002: Skip content duplication check at directory or selection scan. (Closed)
Patch Set: Avoid recursive call of checkState to clarify execution path. Created 4 years 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
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 ba7fa01d114298d13c2d73537b01a0bef6d9fcf5..88f11e7eddacabdcd75593801d13a165503d739d 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
@@ -68,6 +68,31 @@ importer.MediaImportHandler.IMPORTS_TAG_KEY = 'cloud-import';
// files start being imported.
importer.MediaImportHandler.IMPORTS_TAG_VALUE = 'media';
+/**
+ * Updates notification item with content scan progress.
+ *
+ * @param {!importer.TaskQueue.Task} task
+ * @param {number} newFileCount number of new files found so far
+ * @param {number} progress progress of the scan
+ */
+importer.MediaImportHandler.prototype.updateContentScanProgress =
+ function(task, newFileCount, progress) {
+ var item = this.progressCenter_.getItemById(task.taskId);
+ if (!item) {
+ item = new ProgressCenterItem();
+ item.id = task.taskId;
+ item.type = ProgressItemType.COPY;
+ item.progressMax = 100;
+ item.cancelCallback = function() {
+ task.requestCancel();
+ };
+ }
+ item.message = strf('CLOUD_IMPORT_STATUS_PREPARING', newFileCount);
+ item.progressValue = progress;
+ item.state = ProgressItemState.PROGRESSING;
+ this.progressCenter_.updateItem(item);
+}
+
/** @override */
importer.MediaImportHandler.prototype.importFromScanResult =
function(scanResult, destination, directoryPromise) {
@@ -80,6 +105,10 @@ importer.MediaImportHandler.prototype.importFromScanResult =
destination,
this.tracker_);
+ if (!scanResult.isFinal()) {
+ // TODO(yamaguchi): Update progress of the scan in progress event handler.
+ this.updateContentScanProgress(task, 0, 0);
+ }
task.addObserver(this.onTaskProgress_.bind(this, task));
task.addObserver(this.onFileImported_.bind(this, task));

Powered by Google App Engine
This is Rietveld 408576698