Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/system_monitor/removable_device_notifications_histogram .h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/metrics/histogram.h" | |
| 9 | |
| 10 namespace chrome { | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 // MediaDeviceNotification.DeviceInfo histogram values. | |
| 15 enum DeviceInfoHistogramBuckets { | |
| 16 MASS_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE, | |
| 17 MASS_STORAGE_DEVICE_NAME_AVAILABLE_AND_UUID_NOT_AVAILABLE, | |
|
vandebo (ex-Chrome)
2012/09/16 22:27:46
could call this FOO_UUID_MISSING
kmadhusu
2012/09/17 18:29:07
Done.
| |
| 18 MASS_STORAGE_DEVICE_NAME_NOT_AVAILABLE_AND_UUID_AVAILABLE, | |
| 19 MASS_STORAGE_DEVICE_NAME_AND_UUID_NOT_AVAILABLE, | |
| 20 MTP_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE, | |
|
vandebo (ex-Chrome)
2012/09/16 22:27:46
the removable device notifiers only handle mass st
kmadhusu
2012/09/17 18:29:07
Moved to MediaStorageUtil.
| |
| 21 MTP_STORAGE_DEVICE_NAME_AVAILABLE_AND_UUID_NOT_AVAILABLE, | |
| 22 MTP_STORAGE_DEVICE_NAME_NOT_AVAILABLE_AND_UUID_AVAILABLE, | |
| 23 MTP_STORAGE_DEVICE_NAME_AND_UUID_NOT_AVAILABLE, | |
| 24 DEVICE_INFO_BUCKET_BOUNDARY | |
| 25 }; | |
| 26 | |
| 27 } // namespace | |
| 28 | |
| 29 void RecordDeviceInfoHistogram(MediaStorageUtil::Type device_type, | |
|
vandebo (ex-Chrome)
2012/09/16 22:27:46
bool mass_storage, so you don't have to figure out
kmadhusu
2012/09/17 18:29:07
Done.
| |
| 30 const std::string& device_uuid, | |
| 31 const string16& device_name) { | |
| 32 int event_number = device_type == MediaStorageUtil::MTP_OR_PTP ? 4 : 0; | |
| 33 event_number += device_name.empty() ? 2 : 0; | |
|
vandebo (ex-Chrome)
2012/09/16 22:27:46
if (device_name.empty()) event_number += 2;
kmadhusu
2012/09/17 18:29:07
Done.
| |
| 34 event_number += device_uuid.empty() ? 1 : 0; | |
| 35 enum DeviceInfoHistogramBuckets event = | |
| 36 static_cast<enum DeviceInfoHistogramBuckets>(event_number); | |
| 37 if (event >= DEVICE_INFO_BUCKET_BOUNDARY) { | |
| 38 NOTREACHED(); | |
| 39 return; | |
| 40 } | |
| 41 UMA_HISTOGRAM_ENUMERATION("MediaDeviceNotifications.DeviceInfo", event, | |
| 42 DEVICE_INFO_BUCKET_BOUNDARY); | |
| 43 } | |
| 44 | |
| 45 } // namespace chrome | |
| OLD | NEW |