Commit 7746024d authored by Robert Kaplow's avatar Robert Kaplow Committed by Commit Bot

Update UKM Sync checks.

This changed the datatype checks from GetPreferredDataTypes to GetActiveDataTypes and adds IsSyncFeatureActive() check instead of connection_status.

Tested end-to-end verified against the butter experiment.

Bug: 906609
Change-Id: I23c0f80cf707a1e8cca5b3f2aa99a3aebc6eec94
Reviewed-on: https://chromium-review.googlesource.com/c/1343369
Commit-Queue: Robert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610100}
parent fda95a19
......@@ -21,6 +21,8 @@ namespace ukm {
const base::Feature kUkmCheckAuthErrorFeature{"UkmCheckAuthError",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kUkmCheckEnabledForDatatypes{
"UkmCheckEnabledForDatatypes", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kUkmPurgingOnConnection{"UkmPurgingOnConnection",
base::FEATURE_DISABLED_BY_DEFAULT};
......@@ -79,13 +81,37 @@ SyncDisableObserver::SyncState SyncDisableObserver::GetSyncState(
UrlKeyedDataCollectionConsentHelper* consent_helper) {
syncer::SyncTokenStatus status = sync_service->GetSyncTokenStatus();
SyncState state;
state.history_enabled = sync_service->GetPreferredDataTypes().Has(
syncer::HISTORY_DELETE_DIRECTIVES);
state.extensions_enabled =
sync_service->GetPreferredDataTypes().Has(syncer::EXTENSIONS);
// For the following two settings, we want them to match the state of a user
// having history/extensions enabled in their Sync settings. Using it to track
// active connections here is undesirable as changes in these states trigger
// data purges.
if (base::FeatureList::IsEnabled(kUkmCheckEnabledForDatatypes)) {
state.history_enabled = sync_service->GetPreferredDataTypes().Has(
syncer::HISTORY_DELETE_DIRECTIVES) &&
sync_service->IsSyncFeatureEnabled();
state.extensions_enabled =
sync_service->GetPreferredDataTypes().Has(syncer::EXTENSIONS) &&
sync_service->IsSyncFeatureEnabled();
} else {
// If kUkmCheckEnabledForDatatypes is disabled, use legacy settings.
// TODO(rkaplow): Clean this up after crbug.com/906609.
state.history_enabled = sync_service->GetPreferredDataTypes().Has(
syncer::HISTORY_DELETE_DIRECTIVES);
state.extensions_enabled =
sync_service->GetPreferredDataTypes().Has(syncer::EXTENSIONS);
}
state.initialized = sync_service->IsEngineInitialized();
// We use CONNECTION_OK here as an auth error can be used in the sync
// paused state. Therefore we need to be more direct and check CONNECTION_OK
// as opposed to using something like IsSyncFeatureActive().
state.connected = !base::FeatureList::IsEnabled(kUkmCheckAuthErrorFeature) ||
status.connection_status == syncer::CONNECTION_OK;
state.passphrase_protected =
state.initialized && sync_service->IsUsingSecondaryPassphrase();
if (consent_helper) {
......
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