• Mikel Astiz's avatar
    Unify clearing of sync prefs · 44d3aa82
    Mikel Astiz authored
    SyncPrefs is a thin layer on top of preferences and hosts two groups
    of preferences:
    1) Actual user-facing settings, such as type-selection, exposed via
       SyncUserSettings.
    2) Local "bookkeeping" sync metadata, such the last synced time or the
       client ID (cache GUID).
    
    In addition, there are two cases that fall somewhere in the middle,
    whose behavior is changed in this patch:
    a) FirstSetupComplete: which roughly represents the user having
       consented to sync-the-feature (as opposed to transport-only upon
       sign-in without explicit user consent).
    b) The encryption-bootstrap-token: which represent an explicit
       passphrase (usually custom passphrase) entered by the user, that
       allows decrypting the incoming sync changes and encrypt outgoing
       ones.
    
    The last two preferences above fit group 1 better, so this patch stops
    clearing them in SyncPrefs::ClearPreferences(), now renamed to
    SyncPrefs::ClearLocalSyncTransportData().
    
    With such cleanup, what used to be
    ClearDirectoryConsistencyPreferences() is now merged into a single
    clearing function, ClearLocalSyncTransportData(), and all calling sites
    are unified by directly clearing prefs in ShutdownImpl(DISABLE_SYNC), as
    opposed to individual calling sites.
    
    This introduces -arguably desirable- behavioral changes because
    codepaths like RESET_LOCAL_SYNC_DATA or STOP_SYNC_FOR_DISABLED_ACCOUNT
    now actually clear all local metadata, which most notably includes
    keystore keys.
    
    Change-Id: I2c42f98c4e068c7e340580d0b78a5cd5b5c46171
    Bug: 1046237
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023649
    Commit-Queue: Mikel Astiz <mastiz@chromium.org>
    Reviewed-by: default avatarMarc Treib <treib@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#735841}
    44d3aa82
profile_sync_service_unittest.cc 62.6 KB