| 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 0d129a01b06d6768247b07dd7de2deb87e08ac75..7e24c54a5bb1cead5d8251877cb28ec4555a0631 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/import_controller.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/import_controller.js
|
| @@ -148,7 +148,10 @@ importer.ImportController.prototype.onScanEvent_ = function(event, scan) {
|
|
|
| /** @private */
|
| importer.ImportController.prototype.onWindowClosing_ = function() {
|
| - this.scanManager_.reset(); // Will cancel any active scans.
|
| + // If the scan is run as a preparation of import, leave it running.
|
| + if (this.activeImport_)
|
| + return;
|
| + this.scanManager_.reset(); // Will cancel any active scans otherwise.
|
| };
|
|
|
| /**
|
| @@ -175,7 +178,7 @@ importer.ImportController.prototype.onDirectoryChanged_ = function(event) {
|
| this.scanManager_.reset();
|
| if (this.isCurrentDirectoryScannable_()) {
|
| this.checkState_(
|
| - this.scanManager_.getDirectoryScan(importer.ScanMode.CONTENT));
|
| + this.scanManager_.getDirectoryScan(importer.ScanMode.HISTORY));
|
| } else {
|
| this.checkState_();
|
| }
|
| @@ -202,7 +205,7 @@ importer.ImportController.prototype.onSelectionChanged_ = function() {
|
| if (this.environment_.getSelection().length === 0 &&
|
| this.isCurrentDirectoryScannable_()) {
|
| this.checkState_(
|
| - this.scanManager_.getDirectoryScan(importer.ScanMode.CONTENT));
|
| + this.scanManager_.getDirectoryScan(importer.ScanMode.HISTORY));
|
| } else {
|
| this.checkState_();
|
| }
|
| @@ -226,7 +229,7 @@ importer.ImportController.prototype.onScanInvalidated_ = function() {
|
| if (this.environment_.getSelection().length === 0 &&
|
| this.isCurrentDirectoryScannable_()) {
|
| this.checkState_(
|
| - this.scanManager_.getDirectoryScan(importer.ScanMode.CONTENT));
|
| + this.scanManager_.getDirectoryScan(importer.ScanMode.HISTORY));
|
| } else {
|
| this.checkState_();
|
| }
|
| @@ -291,7 +294,8 @@ importer.ImportController.prototype.startImportTask_ = function() {
|
| console.assert(!this.activeImport_,
|
| 'Cannot execute while an import task is already active.');
|
|
|
| - var scan = this.scanManager_.getActiveScan();
|
| + this.scanManager_.reset();
|
| + var scan = this.tryScan_(importer.ScanMode.CONTENT);
|
| assert(scan != null);
|
|
|
| var startDate = new Date();
|
| @@ -367,7 +371,7 @@ importer.ImportController.prototype.checkState_ = function(opt_scan) {
|
| // NOTE, that tryScan_ lazily initializes scans...so if
|
| // no scan is returned, no scan is possible for the
|
| // current context.
|
| - var scan = this.tryScan_(importer.ScanMode.CONTENT);
|
| + var scan = this.tryScan_(importer.ScanMode.HISTORY);
|
| // If no scan is created, then no scan is possible in
|
| // the current context...so hide the UI.
|
| if (!scan) {
|
| @@ -401,13 +405,18 @@ importer.ImportController.prototype.checkState_ = function(opt_scan) {
|
| this.fitsInAvailableSpace_(opt_scan).then(
|
| /** @param {boolean} fits */
|
| function(fits) {
|
| - if (!fits) {
|
| - this.updateUi_(
|
| - importer.ActivityState.INSUFFICIENT_SPACE,
|
| - opt_scan);
|
| - return;
|
| - }
|
| -
|
| + if (!fits) {
|
| + this.updateUi_(
|
| + importer.ActivityState.INSUFFICIENT_SPACE,
|
| + opt_scan);
|
| + return;
|
| + }
|
| + if (opt_scan.mode == importer.ScanMode.CONTENT) {
|
| + this.startImportTask_();
|
| + this.updateUi_(importer.ActivityState.IMPORTING,
|
| + this.activeImport_.scan);
|
| + return;
|
| + }
|
| this.updateUi_(
|
| importer.ActivityState.READY, // to import...
|
| opt_scan);
|
|
|