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

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

Issue 918713003: Files.app: Add analytics code to instrument cloud import flows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback. Created 5 years, 10 months 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/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 a5d452871598d1d6a5c8df84fe9c319f4673ef86..c3d13c04c90f23a1bcc3634cbf2bbcf4b630b595 100644
--- a/ui/file_manager/file_manager/foreground/js/import_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/import_controller.js
@@ -28,9 +28,10 @@ importer.ResponseId = {
* @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;
@@ -47,6 +48,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 {?{
@@ -107,6 +111,10 @@ importer.ImportController.prototype.onScanEvent_ = function(event, scan) {
* @private
*/
importer.ImportController.prototype.onVolumeUnmounted_ = function(volumeId) {
+ if (this.activeImport_) {
+ this.activeImport_.task.requestCancel();
Steve McKay 2015/02/17 23:47:51 Nice! Thanks for taking care of this.
Ben Kwa 2015/02/18 22:23:02 Acknowledged.
+ this.tracker_.send(metrics.Events.DEVICE_YANKED);
+ }
this.scanManager_.reset();
this.checkState_();
};
@@ -289,7 +297,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;
});
};

Powered by Google App Engine
This is Rietveld 408576698