• Sylvain Defresne's avatar
    Cache authenticated account info in PrimaryAccountManager · 2b11fa8b
    Sylvain Defresne authored
    The PrimaryAccountManager used to store just the CoreAccountId of the
    authenticated account and to fetch the extended information from the
    AccountTrackerService.
    
    This could result in missing information if the account is removed
    from the AccountTrackerService while the authenticated account is
    not yet cleared. This should not have been a problem as it should not
    happen in production however some regression where found during the
    introduction of IdentityManager.
    
    To fix those inconsistencies, IdentityManager was changed to cache
    the information about the primary account. This however meant that
    two objects are now storing the same information. Also the value
    passed to GoogleSignedOut() method could still be inconsistent.
    
    This CL removes the cache from IdentityManager and instead move it
    to PrimaryAccountManager. This was not possible at the time due to
    complex inheritance in PrimaryAccountManager (formerly SigninManager).
    
    After this change, the information is stored in PrimaryAccountManager
    and updated by IdentityManager when information is updated in the
    AccountTrackerService (AccountTrackerService does not use Observer
    but instead a callback which can only have one target, this target
    is IdentityManager::OnAccountUpdated).
    
    The CL also remove PrimaryAccountManager::SetAuthenticatedInfo() as
    it is equivalent to calling AccountTrackerService::SeedAccountInfo()
    followed by PrimaryAccountManager::SignIn().
    
    Bug: 862619
    Change-Id: I5f0d7a13f6886c2d1f5db5b83d967f60380d206f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1782173
    Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
    Reviewed-by: default avatarDavid Roger <droger@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#694764}
    2b11fa8b
identity_manager.h 32.2 KB