Commit d42a3fd0 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[filesapp] Update SWA file_manager_fake.js helpers

 Add launcher.launchFileManager()
  - move this part out of file_manager.js changes in CL:2500642
 Add ready() handler to read load time data
  - move this part out of file_manager.js changes in CL:2500642
 Add getVolumeManager() helper
  - to match this new helper, which was added in CL:2534551 for
    moving VolumeManager into JS modules
 Re-position the various background fake classes
  - move them so they are adjacent in the code

Tbr: alex
Bug: 1113981
Change-Id: Ia301098b5e0a357d69b7ee5e89560f7cc6b8210f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2539255Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Auto-Submit: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827657}
parent 62edf327
......@@ -137,70 +137,144 @@ window.chrome.metricsPrivate = {
recordValue: (metricName, value) => {},
};
window.DriveSyncHandler = class extends EventTarget {
/**
* Returns the completed event name.
* @return {string}
*/
getCompletedEventName() {}
window.BackgroundWindowSWA = class {
constructor() {
/**
* @type {!FileBrowserBackground|!FileBrowserBackgroundFull}
*/
this.background = new FileBrowserBackgroundFull();
/**
* Returns whether the Drive sync is currently suppressed or not.
* @return {boolean}
*/
isSyncSuppressed() {}
/**
* @type {!Object}
*/
this.launcher = {
/** @param {Object=} appState App state. */
launchFileManager(appState) {
window.fileManagerLaunchNewWindow(appState);
},
};
/**
* @type {!DriveSyncHandler}
*/
this.driveSyncHandler = new DriveSyncHandler();
}
/**
* Shows a notification that Drive sync is disabled on cellular networks.
* @param {Window} window
*/
showDisabledMobileSyncNotification() {}
registerDialog(window) {}
}
window.FileBrowserBackground = class {
constructor() {
/**
* Dialogs
* @type {!Object<!Window>}
*/
this.dialogs;
/**
* String assets. Notable difference here: files app extern defines
* this string object on FileBrowserBackgroundFull.
* @type {Object<string>}
*/
this.stringData;
}
/**
* @return {boolean} Whether the handler is syncing items or not.
* @param {function()} callback Ready callback.
*/
get syncing() {}
ready(callback) {
window.fileManagerLoadScript('strings.js').then(() => {
this.stringData = window.loadTimeData.data_;
window.loadTimeData.data_ = null;
callback();
});
}
}
window.BackgroundPageFake = class {
window.FileBrowserBackgroundFull = class extends FileBrowserBackground {
constructor() {
super();
/**
* @type {FileBrowserBackground}
* @type {!DriveSyncHandler}
*/
this.background;
this.driveSyncHandler;
/**
* @type {!Object}
* @type {!ProgressCenter}
*/
this.launcher = {};
this.progressCenter = new ProgressCenter();
/**
* @private @type {VolumeManager}
* @type {FileOperationManager}
*/
this.volumeManagerInstance_;
this.fileOperationManager = new FileOperationManager();
/**
* @type {!VolumeManagerFactory}
* @type {!importer.ImportRunner}
*/
this.volumeManagerFactory = /** @type {!Object} */ ({
/** @return {!VolumeManager} */
getInstance() {
if (!this.volumeManagerInstance_) {
this.volumeManagerInstance_ = new VolumeManager();
}
return this.volumeManagerInstance_;
},
});
this.mediaImportHandler = new MediaImportHandler();
/**
* @type {!DriveSyncHandler}
* @type {!importer.MediaScanner}
*/
this.driveSyncHandler = new DriveSyncHandler();
this.mediaScanner = new MediaScanner();
/**
* @type {!importer.HistoryLoader}
*/
this.historyLoader = new HistoryLoader();
/**
* @type {!Crostini}
*/
this.crostini = new Crostini();
/**
* @private @type {VolumeManager}
*/
this.volumeManagerInstance_;
}
/**
* @param {Window} window
* Returns VolumeManager instance.
* @public
* @return {!VolumeManager}
*/
registerDialog(window) {}
getVolumeManager() {
if (!this.volumeManagerInstance_) {
this.volumeManagerInstance_ = new VolumeManager();
}
return this.volumeManagerInstance_;
}
}
window.DriveSyncHandler = class extends EventTarget {
/**
* Returns the completed event name.
* @return {string}
*/
getCompletedEventName() {}
/**
* Returns whether the Drive sync is currently suppressed or not.
* @return {boolean}
*/
isSyncSuppressed() {}
/**
* Shows a notification that Drive sync is disabled on cellular networks.
*/
showDisabledMobileSyncNotification() {}
/**
* @return {boolean} Whether the handler is syncing items or not.
*/
get syncing() {}
}
window.VolumeManager = class {
......@@ -391,64 +465,6 @@ window.VolumeInfoListFake = class {
}
}
window.FileBrowserBackground = class {
constructor() {
/** @type {!Object<!Window>} */
this.dialogs;
}
/**
* @param {function()} callback
*/
ready(callback) {}
}
window.FileBrowserBackgroundFull = class extends FileBrowserBackground {
constructor() {
super();
/**
* @type {!DriveSyncHandler}
*/
this.driveSyncHandler;
/**
* @type {!ProgressCenter}
*/
this.progressCenter;
/**
* String assets.
* @type {Object<string>}
*/
this.stringData;
/**
* @type {FileOperationManager}
*/
this.fileOperationManager;
/**
* @type {!importer.ImportRunner}
*/
this.mediaImportHandler;
/**
* @type {!importer.MediaScanner}
*/
this.mediaScanner;
/**
* @type {!importer.HistoryLoader}
*/
this.historyLoader;
/**
* @type {!Crostini}
*/
this.crostini;
}
}
window.Crostini = class {
/**
* Initialize enabled settings.
......
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