| Index: chrome/browser/system_monitor/media_storage_util.cc
|
| diff --git a/chrome/browser/system_monitor/media_storage_util.cc b/chrome/browser/system_monitor/media_storage_util.cc
|
| index c6a03ed6c1b057450d8aa2ff3bc0b9c237412a72..ce808d4821bf6bf1ac054b405cc13c9aab476ce8 100644
|
| --- a/chrome/browser/system_monitor/media_storage_util.cc
|
| +++ b/chrome/browser/system_monitor/media_storage_util.cc
|
| @@ -11,6 +11,7 @@
|
| #include "base/callback.h"
|
| #include "base/file_util.h"
|
| #include "base/logging.h"
|
| +#include "base/metrics/histogram.h"
|
| #include "base/system_monitor/system_monitor.h"
|
| #include "content/public/browser/browser_thread.h"
|
|
|
| @@ -34,6 +35,19 @@ namespace {
|
|
|
| typedef std::vector<SystemMonitor::RemovableStorageInfo> RemovableStorageInfo;
|
|
|
| +// MediaDeviceNotification.DeviceInfo histogram values.
|
| +enum DeviceInfoHistogramBuckets {
|
| + MASS_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE,
|
| + MASS_STORAGE_DEVICE_UUID_MISSING,
|
| + MASS_STORAGE_DEVICE_NAME_MISSING,
|
| + MASS_STORAGE_DEVICE_NAME_AND_UUID_MISSING,
|
| + MTP_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE,
|
| + MTP_STORAGE_DEVICE_UUID_MISSING,
|
| + MTP_STORAGE_DEVICE_NAME_MISSING,
|
| + MTP_STORAGE_DEVICE_NAME_AND_UUID_MISSING,
|
| + DEVICE_INFO_BUCKET_BOUNDARY
|
| +};
|
| +
|
| // Prefix constants for different device id spaces.
|
| const char kRemovableMassStorageWithDCIMPrefix[] = "dcim:";
|
| const char kRemovableMassStorageNoDCIMPrefix[] = "nodcim:";
|
| @@ -276,6 +290,29 @@ FilePath MediaStorageUtil::FindDevicePathById(const std::string& device_id) {
|
| }
|
|
|
| // static
|
| +void MediaStorageUtil::RecordDeviceInfoHistogram(bool mass_storage,
|
| + const std::string& device_uuid,
|
| + const string16& device_name) {
|
| + unsigned int event_number = 0;
|
| + if (!mass_storage)
|
| + event_number = 4;
|
| +
|
| + if (device_name.empty())
|
| + event_number += 2;
|
| +
|
| + if (device_uuid.empty())
|
| + event_number += 1;
|
| + enum DeviceInfoHistogramBuckets event =
|
| + static_cast<enum DeviceInfoHistogramBuckets>(event_number);
|
| + if (event >= DEVICE_INFO_BUCKET_BOUNDARY) {
|
| + NOTREACHED();
|
| + return;
|
| + }
|
| + UMA_HISTOGRAM_ENUMERATION("MediaDeviceNotifications.DeviceInfo", event,
|
| + DEVICE_INFO_BUCKET_BOUNDARY);
|
| +}
|
| +
|
| +// static
|
| void MediaStorageUtil::SetGetDeviceInfoFromPathFunctionForTesting(
|
| GetDeviceInfoFromPathFunction function) {
|
| g_test_get_device_info_from_path_function = function;
|
|
|