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)); |