Commit def5f52e authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Restrict access to FilesApp background object

Contain all FilesApp foreground access to the background
object to the FileManager class.

This simplifies a lot of the externs dependencies and
I think it provides a cleaner API.

Change-Id: I96716d0c53d538a90adfb04f9f54ce6cd7d72568
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761880Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688460}
parent c5863a9f
......@@ -11,9 +11,6 @@ class CommandHandlerDeps {
/** @type {ActionsController} */
this.actionsController;
/** @type {BackgroundWindow} */
this.backgroundPage;
/** @type {DialogType} */
this.dialogType;
......@@ -71,4 +68,7 @@ class CommandHandlerDeps {
/** @return {FileSelection} */
getSelection() {}
/** @param {Object} appState App state. */
launchFileManager(appState) {}
}
......@@ -86,10 +86,6 @@ js_library("importer_common") {
"../../../externs:volume_manager",
"//ui/file_manager/base/js:volume_manager_types",
]
externs_list = [
"../../../externs/background_window.js",
"../../../externs/background/file_browser_background.js",
]
}
js_library("test_importer_common") {
......
......@@ -437,13 +437,6 @@ class FileManager extends cr.EventTarget {
return this.fileOperationManager_;
}
/**
* @return {BackgroundWindow}
*/
get backgroundPage() {
return this.backgroundPage_;
}
/**
* @return {FilteredVolumeManager}
*/
......@@ -486,6 +479,14 @@ class FileManager extends cr.EventTarget {
return this.ui_;
}
/**
* Launch a new File Manager app.
* @param {Object=} appState App state.
*/
launchFileManager(appState) {
this.backgroundPage_.launcher.launchFileManager(appState);
}
/**
* One time initialization for app state controller to load view option from
* local storage.
......
......@@ -862,7 +862,7 @@ CommandHandler.COMMANDS_['new-folder'] = new class extends Command {
*/
CommandHandler.COMMANDS_['new-window'] = new class extends Command {
execute(event, fileManager) {
fileManager.backgroundPage.launcher.launchFileManager({
fileManager.launchFileManager({
currentDirectoryURL: fileManager.getCurrentDirectoryEntry() &&
fileManager.getCurrentDirectoryEntry().toURL()
});
......
......@@ -1240,9 +1240,8 @@ importer.RuntimeControllerEnvironment = class {
* @private
*/
revealDirectory_(directory) {
this.fileManager_.backgroundPage.launcher.launchFileManager(
{currentDirectoryURL: directory.toURL()},
/* App ID */ undefined);
this.fileManager_.launchFileManager(
{currentDirectoryURL: directory.toURL()});
}
/**
......
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