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

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

Issue 2873903004: Add UMA to count directory-changed events by RootType. (Closed)
Patch Set: Revert unused code Created 3 years, 7 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
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/main_scripts.js ('k') | 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/navigation_uma.js
diff --git a/ui/file_manager/file_manager/foreground/js/navigation_uma.js b/ui/file_manager/file_manager/foreground/js/navigation_uma.js
new file mode 100644
index 0000000000000000000000000000000000000000..4b2078222ce7c84985d4204a62bdfe346ec4be76
--- /dev/null
+++ b/ui/file_manager/file_manager/foreground/js/navigation_uma.js
@@ -0,0 +1,64 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * UMA exporter for navigation in the Files app.
+ *
+ * @param {!VolumeManagerWrapper} volumeManager
+ *
+ * @constructor
+ */
+function NavigationUma(volumeManager) {
+ /**
+ * @type {!VolumeManagerWrapper}
+ * @private
+ */
+ this.volumeManager_ = volumeManager;
+}
+
+/**
+ * Keep the order of this in sync with FileManagerRootType in
+ * tools/metrics/histograms/histograms.xml.
+ *
+ * @type {!Array<VolumeManagerCommon.RootType>}
+ * @const
+ */
+NavigationUma.RootType = [
+ VolumeManagerCommon.RootType.DOWNLOADS,
+ VolumeManagerCommon.RootType.ARCHIVE,
+ VolumeManagerCommon.RootType.REMOVABLE,
+ VolumeManagerCommon.RootType.DRIVE,
+ VolumeManagerCommon.RootType.TEAM_DRIVES_GRAND_ROOT,
+ VolumeManagerCommon.RootType.TEAM_DRIVE,
+ VolumeManagerCommon.RootType.MTP,
+ VolumeManagerCommon.RootType.PROVIDED,
+ VolumeManagerCommon.RootType.DRIVE_OTHER,
+ VolumeManagerCommon.RootType.DRIVE_OFFLINE,
+ VolumeManagerCommon.RootType.DRIVE_SHARED_WITH_ME,
+ VolumeManagerCommon.RootType.DRIVE_RECENT,
+ VolumeManagerCommon.RootType.MEDIA_VIEW,
+];
+
+/**
+ * Exports file type metric with the given |name|.
+ *
+ * @param {!FileEntry} entry
+ * @param {string} name The histogram name.
+ *
+ * @private
+ */
+NavigationUma.prototype.exportRootType_ = function(entry, name) {
+ var locationInfo = this.volumeManager_.getLocationInfo(entry);
+ if (locationInfo)
+ metrics.recordEnum(name, locationInfo.rootType, NavigationUma.RootType);
+};
+
+/**
+ * Exports UMA based on the entry that has became new current directory.
+ *
+ * @param {!FileEntry} entry the new directory
+ */
+NavigationUma.prototype.onDirectoryChanged = function(entry) {
+ this.exportRootType_(entry, 'FileBrowser.ChangeDirectory.RootType');
+};
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/main_scripts.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698