Create Profile.NumberOfActiveProfiles metric

Currently most Profile.NumberOf[...] metrics only count 28DA profiles.
However, the Profile.NumberOfProfiles metric counts all profiles,
including inactive ones.

Add a Profile.NumberOfActiveProfiles metric to use as denominator for
NumberOf[...] metrics that count active profiles. Also update the
documentation on the NumberOf[...] metrics to describe whether they
count all or only active profiles.

BUG=832005

Change-Id: I85a23dfd792e8a39a88459b989e911126a9fca48
Reviewed-on: https://chromium-review.googlesource.com/1021813
Reviewed-by: Mihai Sardarescu <[email protected]>
Reviewed-by: anthonyvd <[email protected]>
Reviewed-by: Mark Pearson <[email protected]>
Commit-Queue: Florian Uunk <[email protected]>
Cr-Commit-Position: refs/heads/master@{#553986}
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc
index d09d548..49eb9f0 100644
--- a/chrome/browser/profiles/profile_metrics.cc
+++ b/chrome/browser/profiles/profile_metrics.cc
@@ -164,6 +164,7 @@
     if (!HasProfileBeenActiveSince(entry, oldest)) {
       counts->unused++;
     } else {
+      counts->active++;
       if (entry->IsSupervised())
         counts->supervised++;
       if (entry->IsAuthenticated()) {
diff --git a/components/profile_metrics/counts.cc b/components/profile_metrics/counts.cc
index 364857a66..b7531fdc 100644
--- a/components/profile_metrics/counts.cc
+++ b/components/profile_metrics/counts.cc
@@ -19,6 +19,7 @@
                              100 * counts.supervised / counts.total);
     UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles",
                              counts.signedin);
+    UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfActiveProfiles", counts.active);
     UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfUnusedProfiles", counts.unused);
     UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfilesWithGAIAIcons",
                              counts.gaia_icon);
diff --git a/components/profile_metrics/counts.h b/components/profile_metrics/counts.h
index a02a972..ef5b8cc 100644
--- a/components/profile_metrics/counts.h
+++ b/components/profile_metrics/counts.h
@@ -13,6 +13,7 @@
   base::HistogramBase::Sample total;
   base::HistogramBase::Sample signedin;
   base::HistogramBase::Sample supervised;
+  base::HistogramBase::Sample active;
   base::HistogramBase::Sample unused;
   base::HistogramBase::Sample gaia_icon;
   base::HistogramBase::Sample auth_errors;
@@ -21,6 +22,7 @@
       : total(0),
         signedin(0),
         supervised(0),
+        active(0),
         unused(0),
         gaia_icon(0),
         auth_errors(0) {}
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 42b7913ab..0fe593ce 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -72651,12 +72651,25 @@
   </summary>
 </histogram>
 
+<histogram name="Profile.NumberOfActiveProfiles">
+  <owner>[email protected]</owner>
+  <summary>
+    Counts the number of profiles on a user's machine at least every 24 hours
+    while Chrome is running. Always de-dupe the results with Show User Counts.
+
+    As opposed to Profile.NumberOfProfiles, this counts only profiles that have
+    been used in the last 28 days.
+  </summary>
+</histogram>
+
 <histogram name="Profile.NumberOfManagedProfiles">
   <owner>[email protected]</owner>
   <summary>
     Counts the number of locally managed profiles on a user's machine at least
     every 24 hours while Chrome is running, among cases with at least one
     profile. Always de-dupe the results with Show User Counts.
+
+    This counts only profiles that have been used in the last 28 days.
   </summary>
 </histogram>
 
@@ -72666,6 +72679,9 @@
   <summary>
     Counts the number of profiles on a user's machine at least every 24 hours
     while Chrome is running. Always de-dupe the results with Show User Counts.
+
+    This counts the total number of profiles on the user's device, regardless of
+    whether they've been used recently.
   </summary>
 </histogram>
 
@@ -72698,6 +72714,8 @@
   <summary>
     Counts the type GAIA authentication errors on a user's machine when Chrome
     starts up. The types of errors are broken down in Signin.AuthError.
+
+    This counts only profiles that have been used in the last 28 days.
   </summary>
 </histogram>
 
@@ -72708,6 +72726,8 @@
     Counts the number of signed-in profiles on a user's machine at least every
     24 hours while Chrome is running. Always de-dupe the results with Show User
     Counts.
+
+    This counts only profiles that have been used in the last 28 days.
   </summary>
 </histogram>
 
@@ -72729,6 +72749,8 @@
     Counts the number of signed-in profiles that are using the GAIA image as the
     avatar icon. This is counted at least every 24 hours while Chrome is
     running, so always de-dupe the results with Show User Counts.
+
+    This counts only profiles that have been used in the last 28 days.
   </summary>
 </histogram>