• Connor Moody's avatar
    Make AppRegistrar observe profile deletion · a874871d
    Connor Moody authored
    Bug:1080703
    
    Currently, web app subsystems in BMO mode are not notified of profile
    deletion because AppRegistrar::NotifyWebAppProfileWillBeDeleted is never
    called on WebAppRegistrar.
    
    In contrast, NotifyWebAppProfileWillBeDeleted is properly called on
    BookmarkAppRegistrar during profile deletion through the following call
    stack:
    
    BookmarkAppRegistrar::NotifyWebAppProfileWillBeDeleted
    BookmarkAppRegistrar::OnExtensionUnloaded
    ExtensionRegistry::TriggerOnUnloaded
    ExtensionRegistrar::DeactivateExtension
    ExtensionRegistrar::RemoveExtension
    ExtensionService::UnloadExtension
    ExtensionService::OnProfileMarkedForPermanentDeletion
    
    This CL makes WebAppRegistrar observe profile deletion through the
    ProfileManagerObserver interface and call
    NotifyWebAppProfileWillBeDeleted accordingly.
    
    NOTE: An alternate implementation that consolidated
    ProfileManagerObserver subscription into AppRegistrar (base class) was
    also explored. However, because ExtensionRegistry (the backend storage
    for BookmarkAppRegistrar) is also a ProfileManagerObsever,
    ExtensionRegistry may be notified of profile deletion first and clean up
    its internal app state before AppRegistrar handles profile deletion and
    queries installed apps. BookmarkAppRegistrar and ExtensionService cannot
    both be ProfileManagerObservers that interact with one another
    during profile deletion.
    
    
    Change-Id: Ic2244e10a3e1d7cc1b0f76ccb18cd1a397d06fff
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2191112Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
    Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
    Reviewed-by: default avatarDavid Bienvenu <davidbienvenu@chromium.org>
    Commit-Queue: Connor Moody <connor.moody@microsoft.com>
    Cr-Commit-Position: refs/heads/master@{#772121}
    a874871d
web_app_provider.cc 11 KB