The previous logic that determined if an event was allowed to be recorded would check SyncService::GetPreferredDataTypes() for membership of syncer::HISTORY_DELETE_DIRECTIVES. This was trying to do type things 1) Make sure that history sync was enabled. 2) Make sure the user was not using a custom passphrase.
However, it only actually did the first, and not the second. This is because of the way that the HISTORY_DELETE_DIRECTIVES's controller reacts to a custom passphrase, it triggers a data type error, which doesn't actually affect GetPreferredDataTypes().
We were using GetPreferredDataTypes() instead of GetActiveDataTypes() because preferred should in general represent a user's intent, while active may be affected by the current state and transient issues. However in this case preferred is not indicative of intent, and thus we did the wrong thing.
To fix this we're adding another check, making sure that SyncService::IsUsingSecondaryPassphrase() is not true. This check will return exactly if a custom passphrase is enabled or not. We still need to keep GetPreferredDataTypes().Has(HISTORY_DELETE_DIRECTIVES) in case the user selectively disables syncing "History" without a custom passphrase.
Keeping this CL as small as possible in hopes to merge it back. I intend to fix code comments and add unit tests/integration tests in a future CL.
Bug: 754073 Change-Id: I1b21f84cbe48ae42f622ed3d31edda42292c7347 Reviewed-on: https://chromium-review.googlesource.com/610343
94afe7b7 [Sync] Stop user events when custom passphrase present.
components/sync/user_events/user_event_service_impl.cc | 1 +
1 file changed, 1 insertion(+)