• Christopher Cameron's avatar
    MacPWAs: Add AppShimRegistry local storage · 81f442ea
    Christopher Cameron authored
    When launching a PWA, it should start where the user left off (that
    is, with the profiles open that the user had open when they quit).
    In order to do this, we need to save in local storage the list of
    profiles for which each app was last active.
    
    While we are creating local storage for PWAs, we often need to know
    for what profiles an app is installed. This is currently implemented
    by poking through the user-data-dir in the filesystem. Putting this
    in local storage is much simpler.
    
    To solve both of these problems, add the AppShimRegistry which
    maintains the following structure in local storage.
    
      "app_shims":{
        "<app_id>":{
          "installed_profiles":[
            "<relative_profile_path_1>",
            "<relative_profile_path_2>",
          ],
          "last_active_profiles":[
            "<relative_profile_path_1>",
          ],
        }
      }
    
    Add hooks to maintain these |installed_profiles| to
    AppShortcutManager, because all shim creation and deletion
    goes through that structure. We will at some point want to
    move this to a PWA-specific component.
    
    Do not yet add hooks to maintain |last_active_profiles| because this
    patch is getting too big. Do add the code indicating where it will
    be used in ExtensionAppShimHandler, and update its tests to not crash
    when using AppShimRegistry.
    
    Add lots o tests.
    
    Bug: 1001213
    Change-Id: I51d931567d9c3a4e1db143aa2b6164dcaa1a0f3e
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1910719Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
    Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
    Commit-Queue: ccameron <ccameron@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#715204}
    81f442ea
browser_prefs.cc 56 KB