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

Side by Side Diff: ui/file_manager/file_manager/foreground/js/quick_view_uma.js

Issue 2628833002: Quick View UMA: export how quick view was opened. (Closed)
Patch Set: Fix closure compilation error. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * UMA exporter for Quick View. 6 * UMA exporter for Quick View.
7 * 7 *
8 * @param {!VolumeManagerWrapper} volumeManager 8 * @param {!VolumeManagerWrapper} volumeManager
9 * 9 *
10 * @constructor 10 * @constructor
11 */ 11 */
12 function QuickViewUma(volumeManager) { 12 function QuickViewUma(volumeManager) {
13 13
14 /** 14 /**
15 * @type {!VolumeManagerWrapper} 15 * @type {!VolumeManagerWrapper}
16 * @private 16 * @private
17 */ 17 */
18 this.volumeManager_ = volumeManager; 18 this.volumeManager_ = volumeManager;
19 } 19 }
20 20
21 /** 21 /**
22 * In which way quick view was opened.
23 * @enum {!string}
fukino 2017/01/12 03:46:01 nit: ! is redundant
oka 2017/01/12 04:14:02 Oops. Done.
24 * @const
25 */
26 QuickViewUma.WayToOpen = {
27 CONTEXT_MENU: 'contextMenu',
28 SPACE_KEY: 'spaceKey',
29 };
30
31 /**
32 * The order should be consistnet with the definition in histograms.xml.
33 *
34 * @const {!Array<QuickViewUma.WayToOpen>}
35 * @private
36 */
37 QuickViewUma.WayToOpenValues_ = [
38 QuickViewUma.WayToOpen.CONTEXT_MENU,
39 QuickViewUma.WayToOpen.SPACE_KEY,
40 ];
41
42 /**
22 * Keep the order of this in sync with FileManagerVolumeType in 43 * Keep the order of this in sync with FileManagerVolumeType in
23 * tools/metrics/histograms/histograms.xml. 44 * tools/metrics/histograms/histograms.xml.
24 * 45 *
25 * @type {!Array<VolumeManagerCommon.VolumeType>} 46 * @type {!Array<VolumeManagerCommon.VolumeType>}
26 * @const 47 * @const
27 */ 48 */
28 QuickViewUma.VolumeType = [ 49 QuickViewUma.VolumeType = [
29 VolumeManagerCommon.VolumeType.DRIVE, 50 VolumeManagerCommon.VolumeType.DRIVE,
30 VolumeManagerCommon.VolumeType.DOWNLOADS, 51 VolumeManagerCommon.VolumeType.DOWNLOADS,
31 VolumeManagerCommon.VolumeType.REMOVABLE, 52 VolumeManagerCommon.VolumeType.REMOVABLE,
(...skipping 24 matching lines...) Expand all
56 * @param {!FileEntry} entry 77 * @param {!FileEntry} entry
57 */ 78 */
58 QuickViewUma.prototype.onEntryChanged = function(entry) { 79 QuickViewUma.prototype.onEntryChanged = function(entry) {
59 this.exportFileType_(entry, 'QuickView.FileType'); 80 this.exportFileType_(entry, 'QuickView.FileType');
60 }; 81 };
61 82
62 /** 83 /**
63 * Exports UMA based on the entry selected when Quick View is opened. 84 * Exports UMA based on the entry selected when Quick View is opened.
64 * 85 *
65 * @param {!FileEntry} entry 86 * @param {!FileEntry} entry
87 * @param {!QuickViewUma.WayToOpen} wayToOpen
fukino 2017/01/12 03:46:01 nit: We usually don't use ! for enum types.
66 */ 88 */
67 QuickViewUma.prototype.onOpened = function(entry) { 89 QuickViewUma.prototype.onOpened = function(entry, wayToOpen) {
68 this.exportFileType_(entry, 'QuickView.FileTypeOnLaunch'); 90 this.exportFileType_(entry, 'QuickView.FileTypeOnLaunch');
91 metrics.recordEnum(
92 'QuickView.WayToOpen', wayToOpen, QuickViewUma.WayToOpenValues_);
93
69 var volumeType = this.volumeManager_.getVolumeInfo(entry).volumeType; 94 var volumeType = this.volumeManager_.getVolumeInfo(entry).volumeType;
70 if (QuickViewUma.VolumeType.includes(volumeType)) { 95 if (QuickViewUma.VolumeType.includes(volumeType)) {
71 metrics.recordEnum( 96 metrics.recordEnum(
72 'QuickView.VolumeType', volumeType, QuickViewUma.VolumeType); 97 'QuickView.VolumeType', volumeType, QuickViewUma.VolumeType);
73 } else { 98 } else {
74 console.error('Unknown volume type: ' + volumeType); 99 console.error('Unknown volume type: ' + volumeType);
75 } 100 }
76 }; 101 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698