Commit 911c3a6f authored by kinaba@chromium.org's avatar kinaba@chromium.org

UMA stats for MTP file system in Chrome OS Files.app.

BUG=363840

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269510 0039d316-1c4b-4281-b951-d872f2087c98
parent 262ec0a4
...@@ -168,6 +168,9 @@ void VolumeInfoToVolumeMetadata( ...@@ -168,6 +168,9 @@ void VolumeInfoToVolumeMetadata(
volume_metadata->volume_type = volume_metadata->volume_type =
file_browser_private::VOLUME_TYPE_TESTING; file_browser_private::VOLUME_TYPE_TESTING;
break; break;
case NUM_VOLUME_TYPE:
NOTREACHED();
break;
} }
// Fill device_type iff the volume is removable partition. // Fill device_type iff the volume is removable partition.
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h"
...@@ -111,6 +112,8 @@ std::string VolumeTypeToString(VolumeType type) { ...@@ -111,6 +112,8 @@ std::string VolumeTypeToString(VolumeType type) {
return "mtp"; return "mtp";
case VOLUME_TYPE_TESTING: case VOLUME_TYPE_TESTING:
return "testing"; return "testing";
case NUM_VOLUME_TYPE:
break;
} }
NOTREACHED(); NOTREACHED();
return ""; return "";
...@@ -801,9 +804,16 @@ void VolumeManager::DoMountEvent(chromeos::MountError error_code, ...@@ -801,9 +804,16 @@ void VolumeManager::DoMountEvent(chromeos::MountError error_code,
return; return;
} }
if (error_code == chromeos::MOUNT_ERROR_NONE || volume_info.mount_condition) if (error_code == chromeos::MOUNT_ERROR_NONE || volume_info.mount_condition) {
mounted_volumes_[volume_info.volume_id] = volume_info; mounted_volumes_[volume_info.volume_id] = volume_info;
if (!is_remounting) {
UMA_HISTOGRAM_ENUMERATION("FileBrowser.VolumeType",
volume_info.type,
NUM_VOLUME_TYPE);
}
}
FOR_EACH_OBSERVER(VolumeManagerObserver, FOR_EACH_OBSERVER(VolumeManagerObserver,
observers_, observers_,
OnVolumeMounted(error_code, volume_info, is_remounting)); OnVolumeMounted(error_code, volume_info, is_remounting));
......
...@@ -40,17 +40,21 @@ namespace file_manager { ...@@ -40,17 +40,21 @@ namespace file_manager {
class MountedDiskMonitor; class MountedDiskMonitor;
class VolumeManagerObserver; class VolumeManagerObserver;
// This manager manages "Drive" and "Downloads" in addition to disks managed // Identifiers for volume types managed by Chrome OS file manager.
// by DiskMountManager.
enum VolumeType { enum VolumeType {
VOLUME_TYPE_GOOGLE_DRIVE, VOLUME_TYPE_TESTING = -1, // Used only in tests.
VOLUME_TYPE_GOOGLE_DRIVE = 0,
VOLUME_TYPE_DOWNLOADS_DIRECTORY, VOLUME_TYPE_DOWNLOADS_DIRECTORY,
VOLUME_TYPE_REMOVABLE_DISK_PARTITION, VOLUME_TYPE_REMOVABLE_DISK_PARTITION,
VOLUME_TYPE_MOUNTED_ARCHIVE_FILE, VOLUME_TYPE_MOUNTED_ARCHIVE_FILE,
VOLUME_TYPE_CLOUD_DEVICE, VOLUME_TYPE_CLOUD_DEVICE,
VOLUME_TYPE_PROVIDED, // File system provided by the FileSystemProvider API. VOLUME_TYPE_PROVIDED, // File system provided by the FileSystemProvider API.
VOLUME_TYPE_MTP, VOLUME_TYPE_MTP,
VOLUME_TYPE_TESTING // The enum values must be kept in sync with FileManagerVolumeType in
// tools/metrics/histograms/histograms.xml. Since enums for histograms are
// append-only (for keeping the number consistent across versions), new values
// for this enum also has to be always appended at the end (i.e., here).
NUM_VOLUME_TYPE,
}; };
struct VolumeInfo { struct VolumeInfo {
......
...@@ -7067,6 +7067,14 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -7067,6 +7067,14 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary> </summary>
</histogram> </histogram>
<histogram name="FileBrowser.VolumeType" enum="FileManagerVolumeType">
<owner>kinaba@chromium.org</owner>
<summary>
Chrome OS File Browser: counts the number of times volumes are mounted for
each volume type.
</summary>
</histogram>
<histogram name="GCM.CheckinRequestStatus" enum="GCMCheckinRequestStatus"> <histogram name="GCM.CheckinRequestStatus" enum="GCMCheckinRequestStatus">
<owner>juyik@chromium.org</owner> <owner>juyik@chromium.org</owner>
<summary>Status code of the outcome of a GCM checkin request.</summary> <summary>Status code of the outcome of a GCM checkin request.</summary>
...@@ -35193,6 +35201,16 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -35193,6 +35201,16 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="6" label="Error"/> <int value="6" label="Error"/>
</enum> </enum>
<enum name="FileManagerVolumeType" type="int">
<int value="0" label="Google Drive"/>
<int value="1" label="Download Folder"/>
<int value="2" label="Removable Disk"/>
<int value="3" label="Archive File"/>
<int value="4" label="Cloud Device"/>
<int value="5" label="FileSystemProvider API"/>
<int value="6" label="MTP (Media Transfer Protocol) Device"/>
</enum>
<enum name="FileType" type="int"> <enum name="FileType" type="int">
<int value="0" label="other"/> <int value="0" label="other"/>
<int value="1" label=".doc"/> <int value="1" label=".doc"/>
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