DescriptionSplit the aggregate dictionary that contains content settings exceptions for all content types into separate dictionary holding one content type each.
Old dictionary entry example:
"www.google.com,*": {"cookies": <value>, "plugins": <value>, last_used: {"cookies": <timestamp>, "plugins": <timestamp>}, "per_plugin": {<resource_id>: <value>}}
Split into separate dictionaries:
cookies:
"www.google.com,*": {"setting": <value>, "last_used": <timestamp>}
plugins:
"www.google.com,*": {"setting": <value>, "last_used": <timestamp>, "per_resource": {<resource_id>: <value>}}
For migration between versions of Chrome, we use a similar logic as when we migrated the default preferences in https://codereview.chromium.org/1004733003/ .
1. On the first run, migrate all settings (PrefProvider::MigrateAllExceptions()).
2. Whenever the old dictionary preference changes, propagate the syncable entries into the new preferences (PrefProvider::OnOldContentSettingsPatternPairsChanged()).
3. Whenever one of the new preferences changes, and it is syncable, we write it back to the old dictionary preference as well (ContentSettingsPref::OnPrefChanged()).
Note that PrefProvider manages its old dictionary preference the same way as ContentSettingsPref does a new preference, and ContentSettingsPref needs access to the old preference as well, which leads to some duplication in the code (UpdateOldPref() is just a modified version of UpdatePref(); both use some of the same constructs). We use the convention of referring to attributes and methods managing the old dictionary preference as "old" in the name.
BUG=452388
Committed: https://crrev.com/c2bda48205f8246990caf262f87f52dd971c78a5
Cr-Commit-Position: refs/heads/master@{#323585}
Patch Set 1 #
Total comments: 4
Patch Set 2 : Fixed resource identifiers. #Patch Set 3 : Rebase, various small changes. #
Total comments: 2
Patch Set 4 : Copy constructor. #Patch Set 5 : Vector of pointers. #Patch Set 6 : Added tests, fixed cleaning of prefs, etc. #Patch Set 7 : Argh, forgot about Android. #Patch Set 8 : Android fix 2. #Patch Set 9 : Get rid of scoped ptrs. #Patch Set 10 : Android fix 4. #
Total comments: 3
Patch Set 11 : s/scoped/linked/ #Patch Set 12 : Fixed tests. #
Total comments: 16
Patch Set 13 : Fixed writing prefs in incognito. #Patch Set 14 : PMI test, unsynced notifications. #Patch Set 15 : Extracted PMI unittest. #Patch Set 16 : ... #
Total comments: 17
Patch Set 17 : Comments, ScopedVector. #
Total comments: 1
Patch Set 18 : Switch fix. #Patch Set 19 : Addressed comments. #Patch Set 20 : Fixed initialization order. #Patch Set 21 : Test fix. #
Total comments: 17
Patch Set 22 : Another round of tests. #Patch Set 23 : Addressed more comments. #Patch Set 24 : Added resource id tests. #Patch Set 25 : Verbatim copying test. #Patch Set 26 : Memory leak in last test. #
Total comments: 3
Messages
Total messages: 32 (8 generated)
|