Componentize ProfileMetrics::Counts
ProfileMetrics::Counts and related histograms are used by all platforms
including iOS, and it is important that iOS remains consistent with the
other platforms.
This CL componentizes these metrics to be able to share them cleanly on
iOS.
TBR=jochen
Review URL: https://codereview.chromium.org/1417903006
Cr-Commit-Position: refs/heads/master@{#357333}
diff --git a/components/profile_metrics/counts.cc b/components/profile_metrics/counts.cc
new file mode 100644
index 0000000..9186d04
--- /dev/null
+++ b/components/profile_metrics/counts.cc
@@ -0,0 +1,30 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/profile_metrics/counts.h"
+
+#include "base/metrics/histogram.h"
+
+namespace profile_metrics {
+
+void LogProfileMetricsCounts(const Counts& counts) {
+ UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfProfiles", counts.total);
+
+ // Ignore other metrics if we have no profiles.
+ if (counts.total > 0) {
+ UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfManagedProfiles",
+ counts.supervised);
+ UMA_HISTOGRAM_COUNTS_100("Profile.PercentageOfManagedProfiles",
+ 100 * counts.supervised / counts.total);
+ UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles",
+ counts.signedin);
+ UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfUnusedProfiles", counts.unused);
+ UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfilesWithGAIAIcons",
+ counts.gaia_icon);
+ UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfProfilesWithAuthErrors",
+ counts.auth_errors);
+ }
+}
+
+} // namespace profile_metrics