Commit 58505ca7 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Fix UMA histogram Sync.InitialState

Before SyncAuthManager::RegisterForAuthNotifications(), the
active/authenticated account isn't initialized, so the histogram would
always record "not signed in". So make sure we record the histogram
only after registering for auth.

Bug: 898430
Change-Id: I00064541cefe6cb65d5a246f12c7a8eaef469c28
Reviewed-on: https://chromium-review.googlesource.com/c/1297420Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602291}
parent de21d05c
...@@ -270,11 +270,8 @@ void ProfileSyncService::Initialize() { ...@@ -270,11 +270,8 @@ void ProfileSyncService::Initialize() {
sync_prefs_.AddSyncPrefObserver(this); sync_prefs_.AddSyncPrefObserver(this);
int disable_reasons = GetDisableReasons();
RecordSyncInitialState(disable_reasons, IsFirstSetupComplete());
// If sync is disallowed by policy, clean up. // If sync is disallowed by policy, clean up.
if (disable_reasons & DISABLE_REASON_ENTERPRISE_POLICY) { if (HasDisableReason(DISABLE_REASON_ENTERPRISE_POLICY)) {
// Note that this won't actually clear data, since neither |engine_| nor // Note that this won't actually clear data, since neither |engine_| nor
// |sync_thread_| exist at this point. Bug or feature? // |sync_thread_| exist at this point. Bug or feature?
StopImpl(CLEAR_DATA); StopImpl(CLEAR_DATA);
...@@ -293,6 +290,11 @@ void ProfileSyncService::Initialize() { ...@@ -293,6 +290,11 @@ void ProfileSyncService::Initialize() {
} }
} }
// Note: We need to record the initial state *after* calling
// RegisterForAuthNotifications(), because before that the authenticated
// account isn't initialized.
RecordSyncInitialState(GetDisableReasons(), IsFirstSetupComplete());
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
std::string bootstrap_token = sync_prefs_.GetEncryptionBootstrapToken(); std::string bootstrap_token = sync_prefs_.GetEncryptionBootstrapToken();
if (bootstrap_token.empty()) { if (bootstrap_token.empty()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment