• Luciano Pacheco's avatar
    Files app: Refactor externs for background page · 0d0342c1
    Luciano Pacheco authored
    This CL fixes some inconsistencies that become larger issues for running
    with JS modules and within SWA container.
    
    Issues:
    1. The `window.background` was defined using `var background =`, however
    for JS Modules this doesn't set in the global `window`.
    
    2. The interface `FileBrowserBackground` is actually used by other apps
    other than Files app, despite the prefix `FileBrowser`. Fix
    by renaming the interface to `BackgroundBase` and in turn rename the
    implementation to `BackgroundBaseImpl`.
    
    3. The implementation `BackgroundBase` doesn't have a `@implements` to
    its interface, which was confusingly named `FileBrowserBackground`. Fix
    by adding the `@implements` accordingly.
    
    4. The methods `ready()` and `setLauncherHandler()` were the defined in
    the wrong interfaces.  Fix by moving `ready()` to
    `FileBrowserBackgroundFull` because it's used only in Files app and move
    `setLauncherHandler()` to `BackgroundBase` because it's used in all
    apps.
    
    No change in behavior, Closure type-checking and current tests cover all
    changes.
    
    Bug: 1148545, 1133186, 1113981
    Change-Id: I4ca90e826faf88b7def3b12d89ae249c091ec973
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2534551
    Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
    Commit-Queue: Noel Gordon <noel@chromium.org>
    Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#827162}
    0d0342c1
background.js 2.85 KB