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

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

Issue 2564343002: Mark duplicate files even when scan result found no new files. (Closed)
Patch Set: Avoid recursive call to checkState_. 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
« 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/foreground/js/import_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/import_controller.js b/ui/file_manager/file_manager/foreground/js/import_controller.js
index a217242890392d25874cde149bac5da6085383de..e25e6b0537bc9969e1c60407d610b0dbb3b7cdc3 100644
--- a/ui/file_manager/file_manager/foreground/js/import_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/import_controller.js
@@ -282,13 +282,12 @@ importer.ImportController.prototype.onClick_ =
};
/**
- * Executes import against the current directory. Should only
- * be called when the current directory has been validated
- * by calling "update" on this class.
+ * Executes import against the current context. Should only be called
+ * after the current context has been validated by a scan.
*
* @private
*/
-importer.ImportController.prototype.execute_ = function() {
+importer.ImportController.prototype.startImportTask_ = function() {
console.assert(!this.activeImport_,
'Cannot execute while an import task is already active.');
@@ -308,6 +307,17 @@ importer.ImportController.prototype.execute_ = function() {
};
var taskFinished = this.onImportFinished_.bind(this, importTask);
importTask.whenFinished.then(taskFinished).catch(taskFinished);
+}
+
+/**
+ * Executes import against the current context. Should only be called
+ * when user clicked an import button after the current context has
+ * been validated by a scan.
+ *
+ * @private
+ */
+importer.ImportController.prototype.execute_ = function() {
+ this.startImportTask_();
this.checkState_();
};
@@ -375,7 +385,15 @@ importer.ImportController.prototype.checkState_ = function(opt_scan) {
}
if (opt_scan.getFileEntries().length === 0) {
- this.updateUi_(importer.ActivityState.NO_MEDIA);
+ if (opt_scan.getDuplicateFileEntries().length === 0) {
+ this.updateUi_(importer.ActivityState.NO_MEDIA);
+ return;
+ }
+ // Some scanned files found already exist in Drive.
+ // It means those files weren't marked as already backed up but need to be.
+ // Trigger sync for that purpose, but no files will actually be copied.
+ this.startImportTask_();
Steve McKay 2016/12/27 17:10:58 Seems like this might result in some false reports
yamaguchi 2017/01/05 11:50:04 I agree. I found it's importer.MediaImportHandler.
+ this.updateUi_(importer.ActivityState.IMPORTING, this.activeImport_.scan);
return;
}
« 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