OLD | NEW |
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 * @param {!DialogType} dialogType |
9 * | 10 * |
10 * @constructor | 11 * @constructor |
11 */ | 12 */ |
12 function QuickViewUma(volumeManager) { | 13 function QuickViewUma(volumeManager, dialogType) { |
13 | 14 |
14 /** | 15 /** |
15 * @type {!VolumeManagerWrapper} | 16 * @type {!VolumeManagerWrapper} |
16 * @private | 17 * @private |
17 */ | 18 */ |
18 this.volumeManager_ = volumeManager; | 19 this.volumeManager_ = volumeManager; |
| 20 /** |
| 21 * @type {DialogType} |
| 22 * @private |
| 23 */ |
| 24 this.dialogType_ = dialogType; |
19 } | 25 } |
20 | 26 |
21 /** | 27 /** |
22 * Keep the order of this in sync with FileManagerVolumeType in | 28 * Keep the order of this in sync with FileManagerVolumeType in |
23 * tools/metrics/histograms/histograms.xml. | 29 * tools/metrics/histograms/histograms.xml. |
24 * | 30 * |
25 * @type {!Array<VolumeManagerCommon.VolumeType>} | 31 * @type {!Array<VolumeManagerCommon.VolumeType>} |
26 * @const | 32 * @const |
27 */ | 33 */ |
28 QuickViewUma.VolumeType = [ | 34 QuickViewUma.VolumeType = [ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 */ | 72 */ |
67 QuickViewUma.prototype.onOpened = function(entry) { | 73 QuickViewUma.prototype.onOpened = function(entry) { |
68 this.exportFileType_(entry, 'QuickView.FileTypeOnLaunch'); | 74 this.exportFileType_(entry, 'QuickView.FileTypeOnLaunch'); |
69 var volumeType = this.volumeManager_.getVolumeInfo(entry).volumeType; | 75 var volumeType = this.volumeManager_.getVolumeInfo(entry).volumeType; |
70 if (QuickViewUma.VolumeType.includes(volumeType)) { | 76 if (QuickViewUma.VolumeType.includes(volumeType)) { |
71 metrics.recordEnum( | 77 metrics.recordEnum( |
72 'QuickView.VolumeType', volumeType, QuickViewUma.VolumeType); | 78 'QuickView.VolumeType', volumeType, QuickViewUma.VolumeType); |
73 } else { | 79 } else { |
74 console.error('Unknown volume type: ' + volumeType); | 80 console.error('Unknown volume type: ' + volumeType); |
75 } | 81 } |
| 82 // Record stats of dialog types. It must be in sync with |
| 83 // FileDialogType enum in tools/metrics/histograms/histogram.xml. |
| 84 metrics.recordEnum('QuickView.DialogType', this.dialogType_, |
| 85 [DialogType.SELECT_FOLDER, |
| 86 DialogType.SELECT_UPLOAD_FOLDER, |
| 87 DialogType.SELECT_SAVEAS_FILE, |
| 88 DialogType.SELECT_OPEN_FILE, |
| 89 DialogType.SELECT_OPEN_MULTI_FILE, |
| 90 DialogType.FULL_PAGE]); |
76 }; | 91 }; |
OLD | NEW |