Chromium Code Reviews| 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 f28a901630c26cba34a23934987c5da4471fb27a..3d0869b88dfe4a368e251cdb05b6246ba822195a 100644 |
| --- a/ui/file_manager/file_manager/foreground/js/import_controller.js |
| +++ b/ui/file_manager/file_manager/foreground/js/import_controller.js |
| @@ -39,9 +39,10 @@ importer.CommandUpdate; |
| * @param {!importer.MediaScanner} scanner |
| * @param {!importer.ImportRunner} importRunner |
| * @param {!importer.CommandWidget} commandWidget |
| + * @param {!analytics.Tracker} tracker |
| */ |
| importer.ImportController = |
| - function(environment, scanner, importRunner, commandWidget) { |
| + function(environment, scanner, importRunner, commandWidget, tracker) { |
| /** @private {!importer.ControllerEnvironment} */ |
| this.environment_ = environment; |
| @@ -58,6 +59,9 @@ importer.ImportController = |
| /** @type {!importer.ScanManager} */ |
| this.scanManager_ = new importer.ScanManager(environment, scanner); |
| + /** @private {!analytics.Tracker} */ |
| + this.tracker_ = tracker; |
| + |
| /** |
| * The active import task, if any. |
| * @private {importer.MediaImportHandler.ImportTask} |
| @@ -112,6 +116,10 @@ importer.ImportController.prototype.onScanEvent_ = function(event, scan) { |
| * @private |
| */ |
| importer.ImportController.prototype.onVolumeUnmounted_ = function(volumeId) { |
| + if (this.activeImportTask_) { |
| + this.activeImportTask_.requestCancel(); |
| + this.tracker_.send(importer.metrics.Events.DEVICE_YANKED); |
| + } |
| this.scanManager_.reset(); |
| this.checkState_(); |
| }; |
| @@ -297,7 +305,7 @@ importer.ImportController.prototype.updateUi_ = |
| executable: false, |
| label: strf( |
| 'CLOUD_IMPORT_INSUFFICIENT_SPACE_BUTTON_LABEL', |
| - util.bytesToString(opt_scan.getTotalBytes())), |
| + util.bytesToString(opt_scan.getStatistics().sizeBytes)), |
|
Steve McKay
2015/02/12 17:59:14
DOn't do this. It'll create a merge conflict with
Ben Kwa
2015/02/17 23:01:30
Already merged.
|
| coreIcon: 'report-problem' |
| }); |
| this.commandWidget_.updateDetails(opt_scan); |
| @@ -355,7 +363,7 @@ importer.ImportController.prototype.fitsInAvailableSpace_ = |
| // storage in this calculation on the assumption that we |
| // don't want to completely max out storage...even though |
| // synced files will eventually be evicted from the cache. |
| - return availableSpace > scanResult.getTotalBytes(); |
| + return availableSpace > scanResult.getStatistics().sizeBytes; |
|
Steve McKay
2015/02/12 17:59:14
Ditto.
Ben Kwa
2015/02/17 23:01:30
Acknowledged.
|
| }); |
| }; |
| @@ -658,7 +666,8 @@ importer.RuntimeCommandWidget.prototype.update = function(update) { |
| /** @override */ |
| importer.RuntimeCommandWidget.prototype.updateDetails = function(scan) { |
| this.photoCount_.textContent = scan.getFileEntries().length.toLocaleString(); |
| - this.spaceRequired_.textContent = util.bytesToString(scan.getTotalBytes()); |
| + this.spaceRequired_.textContent = |
| + util.bytesToString(scan.getStatistics().sizeBytes); |
|
Steve McKay
2015/02/12 17:59:14
Ditto.
Ben Kwa
2015/02/17 23:01:30
Acknowledged.
|
| }; |
| /** @override */ |