• Christopher Cameron's avatar
    MacPWAs: Open all last-active profiles at app launch · 32c803d0
    Christopher Cameron authored
    Restructure how shims connect to be as follows
    * (the shim process connects and creates an AppShimHostBootstrap)
    * OnShimProcessConnected is called with the bootstrap, and then split
      to two paths
      * OnShimProcessConnectedForLaunch if we should open a new window
        * (e.g, user clicked on the icon)
        * Use the AppShimRegistry to create a list of windows to open
        * Potentially-asynchronously load the profiles, and then
        * OnShimProcessConnectedForLaunch will go through those profiles
          and create new app windows for them
          * If the app shim is an "old" shim that specified a profile, then
            only open the specified profile
      * OnShimProcessConnectedForRegisterOnly if not
        * (e.g, Chrome created an app window on its own and we're starting
          the shim to display it in its own process)
        * Search for an existing AppShimHost to connect to
        * Create one if needed only because tests want this (that cleanup
          can come later)
    * OnShimProcessConnectedAndAllLaunchesDone is then called by both of
      the above branches. This function will
      * If the above-branch found or created an AppShimHost, then connect
        the bootstrap to it
      * Otherwise, tell the bootstrap that it should quit.
    
    The big difference in structure here is how we load profiles. Prior to
    this change, we
    - Had OnShimProcessConnected asynchronously load the list of profiles
      for which the app is installed
    - Then selected one profile, send it to LoadProfileAndApp, and only
      attached the shim to that one profile.
    By contrast, we now
    - Read profiles from the AppShimRegistry
    - Load all profiles we may want to launch via a chain of calls to
      LoadProfileAndApp
    
    TBR=dominickn
    
    Bug: 1001213
    Change-Id: I4b4355cc79606fc33a6de926af00bce48c086100
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1928016Reviewed-by: default avatarccameron <ccameron@chromium.org>
    Commit-Queue: ccameron <ccameron@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#719201}
    32c803d0
app_shim.mojom 4.64 KB