| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" | 5 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 | 8 |
| 9 namespace arc { | 9 namespace arc { |
| 10 | 10 |
| 11 void UpdateOptInActionUMA(OptInActionType type) { | 11 void UpdateOptInActionUMA(OptInActionType type) { |
| 12 UMA_HISTOGRAM_ENUMERATION("Arc.OptInAction", static_cast<int>(type), | 12 UMA_HISTOGRAM_ENUMERATION("Arc.OptInAction", static_cast<int>(type), |
| 13 static_cast<int>(OptInActionType::SIZE)); | 13 static_cast<int>(OptInActionType::SIZE)); |
| 14 } | 14 } |
| 15 | 15 |
| 16 void UpdateOptInCancelUMA(OptInCancelReason reason) { | 16 void UpdateOptInCancelUMA(OptInCancelReason reason) { |
| 17 UMA_HISTOGRAM_ENUMERATION("Arc.OptInCancel", static_cast<int>(reason), | 17 UMA_HISTOGRAM_ENUMERATION("Arc.OptInCancel", static_cast<int>(reason), |
| 18 static_cast<int>(OptInCancelReason::SIZE)); | 18 static_cast<int>(OptInCancelReason::SIZE)); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void UpdateEnabledStateUMA(bool enabled) { | 21 void UpdateEnabledStateUMA(bool enabled) { |
| 22 UMA_HISTOGRAM_BOOLEAN("Arc.State", enabled); | 22 UMA_HISTOGRAM_BOOLEAN("Arc.State", enabled); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void UpdateProvisioningResultUMA(ProvisioningResult result) { | 25 void UpdateProvisioningResultUMA(ProvisioningResult result, bool managed) { |
| 26 UMA_HISTOGRAM_ENUMERATION("Arc.Provisioning.Result", static_cast<int>(result), | 26 std::string histogram_name = "Arc.Provisioning.Result."; |
| 27 static_cast<int>(ProvisioningResult::SIZE)); | 27 histogram_name += managed ? "Managed" : "Unmanaged"; |
| 28 base::LinearHistogram::FactoryGet( |
| 29 histogram_name, 0, static_cast<int>(ProvisioningResult::SIZE), |
| 30 static_cast<int>(ProvisioningResult::SIZE) + 1, |
| 31 base::HistogramBase::kUmaTargetedHistogramFlag) |
| 32 ->Add(static_cast<int>(result)); |
| 28 } | 33 } |
| 29 | 34 |
| 30 void UpdateProvisioningTiming(const base::TimeDelta& elapsed_time, | 35 void UpdateProvisioningTiming(const base::TimeDelta& elapsed_time, |
| 31 bool success, | 36 bool success, |
| 32 bool managed) { | 37 bool managed) { |
| 33 std::string histogram_name = "Arc.Provisioning.TimeDelta."; | 38 std::string histogram_name = "Arc.Provisioning.TimeDelta."; |
| 34 histogram_name += success ? "Success." : "Failure."; | 39 histogram_name += success ? "Success." : "Failure."; |
| 35 histogram_name += managed ? "Managed" : "Unmanaged"; | 40 histogram_name += managed ? "Managed" : "Unmanaged"; |
| 36 // The macro UMA_HISTOGRAM_CUSTOM_TIMES expects a constant string, but since | 41 // The macro UMA_HISTOGRAM_CUSTOM_TIMES expects a constant string, but since |
| 37 // this measurement happens very infrequently, we do not need to use a macro | 42 // this measurement happens very infrequently, we do not need to use a macro |
| 38 // here. | 43 // here. |
| 39 base::Histogram::FactoryTimeGet( | 44 base::Histogram::FactoryTimeGet( |
| 40 histogram_name, base::TimeDelta::FromSeconds(1), | 45 histogram_name, base::TimeDelta::FromSeconds(1), |
| 41 base::TimeDelta::FromMinutes(6), 50, | 46 base::TimeDelta::FromMinutes(6), 50, |
| 42 base::HistogramBase::kUmaTargetedHistogramFlag) | 47 base::HistogramBase::kUmaTargetedHistogramFlag) |
| 43 ->AddTime(elapsed_time); | 48 ->AddTime(elapsed_time); |
| 44 } | 49 } |
| 45 | 50 |
| 46 } // namespace arc | 51 } // namespace arc |
| OLD | NEW |