Introduce Signin.NumberOfActiveAccounts.* metrics
They come in .Last7Days and .Last28Days variants, and are somewhat
modeled after the existing Profile.NumberOfActiveProfiles histogram.
They track the number of accounts that were "active", i.e. were used as
the primary account in any profile, over the last 7 or 28 days.
They're implemented in a new class ActiveAccountsTracker, which
maintains a dict of <gaia_id_hash, last_active_time> in LocalState and
periodically (once every 24h) records the histograms.
An account is marked as active at profile load and at signin (by
SigninMetricsService), and when a corresponding browser/window becomes
active (by ProfileManager, or BrowserStateActivitySceneAgent on iOS -
similar to how the existing Profile.NumberOf*Profiles metrics are
handled).
Bug: 354887167
Change-Id: Iba5044d90a0151ac86d8de0451317cd8be53767b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5750664
Reviewed-by: Sylvain Defresne <[email protected]>
Code-Coverage: [email protected] <[email protected]>
Commit-Queue: Marc Treib <[email protected]>
Reviewed-by: Alex Ilin <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1340904}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index d4e2a00a..3c5f7761 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -99,6 +99,7 @@
#include "components/plus_addresses/plus_address_prefs.h"
#include "components/privacy_sandbox/tpcd_pref_names.h"
#include "components/sharing_message/sharing_sync_preference.h"
+#include "components/signin/core/browser/active_primary_accounts_metrics_recorder.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ui/webui/settings/reset_settings_handler.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
@@ -1532,6 +1533,8 @@
HidPolicyAllowedDevices::RegisterLocalStatePrefs(registry);
#endif
sessions::SessionIdGenerator::RegisterPrefs(registry);
+ signin::ActivePrimaryAccountsMetricsRecorder::RegisterLocalStatePrefs(
+ registry);
SSLConfigServiceManager::RegisterPrefs(registry);
subresource_filter::IndexedRulesetVersion::RegisterPrefs(
registry, subresource_filter::kSafeBrowsingRulesetConfig.filter_tag);