Commit 9dbd219e authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Chromium LUCI CQ

Files SWA: Change main.js to load the SWA fakes

Change SWA main.js to wait for the fakes to load before loading the
Files app legacy UI.

Bug: 1113981
Change-Id: I56da89ee49b4512066e2533b967da99cfb758032
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586498
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836012}
parent 6f50903e
...@@ -5,22 +5,48 @@ ...@@ -5,22 +5,48 @@
import {BrowserProxy} from './browser_proxy.js' import {BrowserProxy} from './browser_proxy.js'
import {ScriptLoader} from './script_loader.js' import {ScriptLoader} from './script_loader.js'
/**
* @const {boolean}
*/
window.isSWA = true;
/** /**
* Represents file manager application. Starting point for the application * Represents file manager application. Starting point for the application
* interaction. * interaction.
*/ */
class FileManagerApp { class FileManagerApp {
constructor() { constructor() {
console.info('File manager app created ...'); /**
* Creates a Mojo pipe to the C++ SWA container.
* @private @const {!BrowserProxy}
*/
this.browserProxy_ = new BrowserProxy();
} }
/** @return {!BrowserProxy} */
get browserProxy() {
return this.browserProxy_;
}
/**
* Start-up: load the page scripts in order: fakes first (to provide chrome.*
* API that the files app foreground scripts expect for initial render), then
* the files app foreground scripts. Note main_scripts.js should have 'defer'
* true per crbug.com/496525.
*/
async run() { async run() {
await new ScriptLoader('legacy_main_scripts.js').load(); await Promise.all([
console.debug('Legacy code loaded'); new ScriptLoader('file_manager_private_fakes.js').load(),
new ScriptLoader('file_manager_fakes.js').load(),
]);
await Promise.all([
new ScriptLoader('foreground/js/elements_importer.js').load(),
new ScriptLoader('foreground/js/main_scripts.js', {defer: true}).load(),
]);
console.debug('Files app legacy UI loaded');
} }
} }
const app = new FileManagerApp(); const app = new FileManagerApp();
document.addEventListener('DOMContentLoaded', () => { app.run();
app.run();
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment