Commit eb8f8994 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

UserEventServiceImpl: Check IsSyncFeatureEnabled

If IsSyncFeatureEnabled is false, then GetPreferredDataTypes doesn't
really mean anything.
In practice, this wasn't an actual issue: If Sync isn't enabled, then
the whole UserEventService can't upload anything anyway. But still best
to be precise here.

Bug: 907027, 856081
Change-Id: I2e3ee7200118175ed9397b5a1b7d9fedd0eb7692
Reviewed-on: https://chromium-review.googlesource.com/c/1344104Reviewed-by: default avatarvitaliii <vitaliii@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610022}
parent 4b6206a1
......@@ -101,19 +101,22 @@ bool UserEventServiceImpl::MightRecordEvents(bool off_the_record,
}
bool UserEventServiceImpl::CanRecordHistory() {
// Before the engine is initialized, we cannot trust the other fields.
// TODO(vitaliii): Consider using GetState() instead of IsEngineInitialized(),
// because even when IsEngineInitialized() the user still may be configuring
// the datatypes.
// Before the engine is initialized, Sync doesn't know if there is a
// secondary passphrase. Similarly, unless the Sync feature is enabled,
// GetPreferredDataTypes() isn't meaningful.
return sync_service_->IsEngineInitialized() &&
!sync_service_->IsUsingSecondaryPassphrase() &&
sync_service_->IsSyncFeatureEnabled() &&
sync_service_->GetPreferredDataTypes().Has(HISTORY_DELETE_DIRECTIVES);
}
bool UserEventServiceImpl::IsUserEventsDatatypeEnabled() {
// Before the engine is initialized, we cannot trust the other fields.
// Before the engine is initialized, Sync doesn't know if there is a
// secondary passphrase. Similarly, unless the Sync feature is enabled,
// GetPreferredDataTypes() isn't meaningful.
return sync_service_->IsEngineInitialized() &&
!sync_service_->IsUsingSecondaryPassphrase() &&
sync_service_->IsSyncFeatureEnabled() &&
sync_service_->GetPreferredDataTypes().Has(USER_EVENTS);
}
......
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