In some places throughout sync codes where the datatype values on disk would be overridden incorrectly.
For example: In SyncSetupService::SetDataTypeEnabled[1], the code here would grab values from GetPreferredDatatypes (which would include all datatypes as "preferred" if sync_everything is on), and then overrides whatever the user actually had selected when sync_everything was off with them.
[1]https://cs.chromium.org/chromium/src/ios/chrome/browser/sync/sync_setup_service.cc?type=cs&q=onUserChoseDatatypes&sq=package:chromium&l=63-71
mastiz@ suggested the following:
we could change the returned type from ModelTypeSet to something else, a datatype that:
- Internally contains a sync_everything and ModelTypeSet.
- Allows verifying if a datatype is effectively selected (honors sync_everything too).
- Returns, if we really need to (I hope not), the ModelTypeSet that is currently returned by GetPreferredDatatypes() (honors sync_everything).
- Allows mutations (as we discussed earlier in the patch, now wrapped in this class).
- Is accepted by OnUserChoseDatatypes.
This has the advantage that we can accommodate as many lookups or writes as we wish without polluting the various interfaces.
(Note: This discussion happened while addressing crbug/815018).
Comment 1 by mastiz@chromium.org
, Jul 3