Commit 4f1b0f1d authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

Add histgrams to Folder shortcut feature in Files.app.

BUG=none
TEST=Files.app runs, the volume list on the left works.
R=asvitkine@chromium.org, mtomasz@chromium.org

Review URL: https://codereview.chromium.org/22634008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217148 0039d316-1c4b-4281-b951-d872f2087c98
parent 62715ad5
...@@ -35,6 +35,9 @@ function FolderShortcutsDataModel() { ...@@ -35,6 +35,9 @@ function FolderShortcutsDataModel() {
if (list instanceof Array) { if (list instanceof Array) {
list = filter(list); list = filter(list);
// Record metrics.
metrics.recordSmallCount('FolderShortcut.Count', list.length);
var permutation = this.calculatePermitation_(this.array_, list); var permutation = this.calculatePermitation_(this.array_, list);
this.array_ = list; this.array_ = list;
this.firePermutedEvent_(permutation); this.firePermutedEvent_(permutation);
...@@ -160,6 +163,7 @@ FolderShortcutsDataModel.prototype = { ...@@ -160,6 +163,7 @@ FolderShortcutsDataModel.prototype = {
this.firePermutedEvent_( this.firePermutedEvent_(
this.calculatePermitation_(oldArray, this.array_)); this.calculatePermitation_(oldArray, this.array_));
this.save_(); this.save_();
metrics.recordUserAction('FolderShortcut.Add');
return addedIndex; return addedIndex;
}, },
...@@ -184,6 +188,7 @@ FolderShortcutsDataModel.prototype = { ...@@ -184,6 +188,7 @@ FolderShortcutsDataModel.prototype = {
this.firePermutedEvent_( this.firePermutedEvent_(
this.calculatePermitation_(oldArray, this.array_)); this.calculatePermitation_(oldArray, this.array_));
this.save_(); this.save_();
metrics.recordUserAction('FolderShortcut.Remove');
return removedIndex; return removedIndex;
} }
......
...@@ -316,8 +316,10 @@ NavigationList.prototype.renderRoot_ = function(path) { ...@@ -316,8 +316,10 @@ NavigationList.prototype.renderRoot_ = function(path) {
item.setPath(path); item.setPath(path);
var handleClick = function() { var handleClick = function() {
if (item.selected && path !== this.directoryModel_.getCurrentDirPath()) if (item.selected && path !== this.directoryModel_.getCurrentDirPath()) {
metrics.recordUserAction('FolderShortcut.Navigate');
this.changeDirectory_(path); this.changeDirectory_(path);
}
}.bind(this); }.bind(this);
item.addEventListener('click', handleClick); item.addEventListener('click', handleClick);
...@@ -371,6 +373,7 @@ NavigationList.prototype.setContextMenu = function(menu) { ...@@ -371,6 +373,7 @@ NavigationList.prototype.setContextMenu = function(menu) {
/** /**
* Selects the n-th item from the list. * Selects the n-th item from the list.
*
* @param {number} index Item index. * @param {number} index Item index.
* @return {boolean} True for success, otherwise false. * @return {boolean} True for success, otherwise false.
*/ */
...@@ -383,9 +386,12 @@ NavigationList.prototype.selectByIndex = function(index) { ...@@ -383,9 +386,12 @@ NavigationList.prototype.selectByIndex = function(index) {
return false; return false;
// Prevents double-moving to the current directory. // Prevents double-moving to the current directory.
// eg. When user clicks the item, changing directory has already been done in
// click handler.
if (this.directoryModel_.getCurrentDirEntry().fullPath == newPath) if (this.directoryModel_.getCurrentDirEntry().fullPath == newPath)
return false; return false;
metrics.recordUserAction('FolderShortcut.Navigate');
this.changeDirectory_(newPath); this.changeDirectory_(newPath);
return true; return true;
}; };
......
...@@ -3885,6 +3885,34 @@ other types of suffix sets. ...@@ -3885,6 +3885,34 @@ other types of suffix sets.
</summary> </summary>
</histogram> </histogram>
<histogram name="FileBrowser.FolderShortcut.Add">
<summary>
Chrome OS File Browser: this is recorded when the user adds a folder
shortcut.
</summary>
</histogram>
<histogram name="FileBrowser.FolderShortcut.Count">
<summary>
Chrome OS File Browser: number of saved folder shorcuts. This is recorded
when Files.app is launched.
</summary>
</histogram>
<histogram name="FileBrowser.FolderShortcut.Navigate">
<summary>
Chrome OS File Browser: this is recorded when the user clicks or selects a
folder shortcut and is navigated to the target folder.
</summary>
</histogram>
<histogram name="FileBrowser.FolderShortcut.Remove">
<summary>
Chrome OS File Browser: this is recorded when the user removes a folder
shortcut.
</summary>
</histogram>
<histogram name="FileBrowser.Load" units="milliseconds"> <histogram name="FileBrowser.Load" units="milliseconds">
<summary> <summary>
Chrome OS File Browser is an built-in extension without a background page. Chrome OS File Browser is an built-in extension without a background page.
......
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