Commit 5a9bcc28 authored by Sasha Morrissey's avatar Sasha Morrissey Committed by Commit Bot

Add 2 new UMAs for the files app

Add 2 new UMAs for the files app:
- FileBrowser.SelectSearch, recorded when the user selects the 'Search' button
- FileBrowser.ToggleFileListType, recorded when the user switches between the
  'grid view' and 'list view' options of the files app

mouse), and change the grid view type, then check chrome://histograms.

Test: Select the search box (with keyboard shortcuts, or with tab, or with the
Bug: 397213
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Icf073dfae57717a91a6f6dbedc3c3d99dcecbdb3
Reviewed-on: https://chromium-review.googlesource.com/957566
Commit-Queue: Sasha Morrissey <sashab@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarNaoki Fukino <fukino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546021}
parent 777cefdf
......@@ -5025,6 +5025,14 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description>
</action>
<action name="FileBrowser.SelectSearch">
<owner>sashab@chromium.org</owner>
<description>
Chrome OS Files App: When the user focused the search field at the top of
the file manager app.
</description>
</action>
<action name="FileBrowser.SuggestApps.ShowDialog">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description>
......
......@@ -18864,6 +18864,12 @@ Called by update_net_error_codes.py.-->
<int value="6" label="Error"/>
</enum>
<enum name="FileManagerListType">
<int value="0" label="Uninitialized"/>
<int value="1" label="List view (detail)"/>
<int value="2" label="Grid view (thumbnail)"/>
</enum>
<enum name="FileManagerMenuCommands">
<int value="0" label="Help"/>
<int value="1" label="Help (In Google Drive)"/>
......@@ -27084,6 +27084,14 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>
<histogram name="FileBrowser.ToggleFileListType" enum="FileManagerListType">
<owner>sashab@chromium.org</owner>
<summary>
Chrome OS Files App: Recorded when the Grid View/List View toggle menu icon
is selected.
</summary>
</histogram>
<histogram name="FileBrowser.ViewingFileType" enum="ViewFileType">
<owner>joshwoodward@google.com</owner>
<summary>
......@@ -296,11 +296,12 @@ MainWindowComponent.prototype.onToggleViewButtonClick_ = function(event) {
this.ui_.listContainer.currentListType === ListContainer.ListType.DETAIL ?
ListContainer.ListType.THUMBNAIL :
ListContainer.ListType.DETAIL;
this.ui_.setCurrentListType(listType);
this.appStateController_.saveViewOptions();
this.ui_.listContainer.focus();
metrics.recordEnum(
'ToggleFileListType', listType, ListContainer.ListTypesForUMA);
};
/**
......
......@@ -310,6 +310,7 @@
'dependencies': [
'../../../../externs/compiled_resources2.gyp:search_item',
'../../../common/js/compiled_resources2.gyp:file_type',
'../../../common/js/compiled_resources2.gyp:metrics',
'../../../common/js/compiled_resources2.gyp:util',
'../../elements/compiled_resources2.gyp:files_toggle_ripple',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:assert',
......
......@@ -149,6 +149,25 @@ ListContainer.ListType = {
THUMBNAIL: 'thumb'
};
/**
* Keep the order of this in sync with FileManagerListType in
* tools/metrics/histograms/enums.xml.
* The array indices will be recorded in UMA as enum values. The index for each
* root type should never be renumbered nor reused in this array.
*
* @type {Array<ListContainer.ListType>}
* @const
*/
ListContainer.ListTypesForUMA = Object.freeze([
ListContainer.ListType.UNINITIALIZED,
ListContainer.ListType.DETAIL,
ListContainer.ListType.THUMBNAIL,
]);
console.assert(
Object.keys(ListContainer.ListType).length ===
ListContainer.ListTypesForUMA.length,
'Members in ListTypesForUMA do not match those in ListType.');
ListContainer.prototype = /** @struct */ {
/**
* @return {!FileTable|!FileGrid}
......
......@@ -189,7 +189,7 @@ SearchBox.prototype.clear = function() {
SearchBox.prototype.setHidden = function(hidden) {
this.element.hidden = hidden;
this.searchButton.hidden = hidden;
}
};
/**
* @private
......@@ -208,6 +208,7 @@ SearchBox.prototype.onFocus_ = function() {
this.autocompleteList.attachToInput(this.inputElement);
this.updateStyles_();
this.searchButtonToggleRipple_.activated = true;
metrics.recordUserAction('SelectSearch');
};
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment