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

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: Reorg/rename metrics events. Fix a metrics loading bug. 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 3a62578beb0205e59c2a5b54ed2447706ee4136f..6825c30ee7f5b2f9aabd7b5920a0d4177a236d56 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.ActivityState = {
* @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 {?importer.TaskDetails_}
@@ -124,6 +128,10 @@ importer.ImportController.prototype.onScanEvent_ = function(event, scan) {
* @private
*/
importer.ImportController.prototype.onVolumeUnmounted_ = function(volumeId) {
+ if (this.activeImport_) {
+ this.activeImport_.task.requestCancel();
+ this.tracker_.send(metrics.ImportEvents.DEVICE_YANKED);
+ }
this.scanManager_.reset();
this.checkState_();
};
@@ -212,6 +220,7 @@ importer.ImportController.prototype.onClick_ =
importer.ImportController.prototype.execute = function() {
console.assert(!this.activeImport_,
'Cannot execute while an import task is already active.');
+ // TODO(kenobi): Record import button clicked.
var scan = this.scanManager_.getActiveScan();
assert(scan != null);
@@ -339,7 +348,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;
});
};
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/file_manager.js ('k') | ui/file_manager/file_manager/foreground/js/main_scripts.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698