| Index: ui/file_manager/file_manager/foreground/js/file_manager_commands.js
|
| diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
|
| index c8f683f0dc6eefe7d938298e776f7f5192fe47e9..8831c630609f28edf94304c513dc06cabe999d9e 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
|
| @@ -28,14 +28,14 @@ var Command = function() {};
|
| /**
|
| * Handles the execute event.
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps.
|
| */
|
| Command.prototype.execute = function(event, fileManager) {};
|
|
|
| /**
|
| * Handles the can execute event.
|
| * @param {!Event} event Can execute event.
|
| - * @param {!FileManager} fileManager FileManager.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps.
|
| */
|
| Command.prototype.canExecute = function(event, fileManager) {};
|
|
|
| @@ -106,7 +106,7 @@ CommandUtil.getParentEntry = function(element, directoryModel) {
|
|
|
| /**
|
| * @param {EventTarget} element
|
| - * @param {!FileManager} fileManager
|
| + * @param {!CommandHandlerDeps} fileManager
|
| * @return {VolumeInfo}
|
| */
|
| CommandUtil.getElementVolumeInfo = function(element, fileManager) {
|
| @@ -122,7 +122,7 @@ CommandUtil.getElementVolumeInfo = function(element, fileManager) {
|
| };
|
|
|
| /**
|
| - * @param {!FileManager} fileManager
|
| + * @param {!CommandHandlerDeps} fileManager
|
| * @return {VolumeInfo}
|
| */
|
| CommandUtil.getCurrentVolumeInfo = function(fileManager) {
|
| @@ -151,21 +151,21 @@ CommandUtil.getEntryFromNavigationModelItem_ = function(item) {
|
| /**
|
| * Checks if command can be executed on drive.
|
| * @param {!Event} event Command event to mark.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| CommandUtil.canExecuteEnabledOnDriveOnly = function(event, fileManager) {
|
| - event.canExecute = fileManager.isOnDrive();
|
| + event.canExecute = fileManager.directoryModel.isOnDrive();
|
| };
|
|
|
| /**
|
| * Sets the command as visible only when the current volume is drive and it's
|
| * running as a normal app, not as a modal dialog.
|
| * @param {!Event} event Command event to mark.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| -CommandUtil.canExecuteVisibleOnDriveInNormalAppModeOnly =
|
| - function(event, fileManager) {
|
| - var enabled = fileManager.isOnDrive() &&
|
| +CommandUtil.canExecuteVisibleOnDriveInNormalAppModeOnly = function(
|
| + event, fileManager) {
|
| + var enabled = fileManager.directoryModel.isOnDrive() &&
|
| !DialogType.isModal(fileManager.dialogType);
|
| event.canExecute = enabled;
|
| event.command.setHidden(!enabled);
|
| @@ -218,14 +218,14 @@ CommandUtil.forceDefaultHandler = function(node, commandId) {
|
| CommandUtil.defaultCommand = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| fileManager.document.execCommand(event.command.id);
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| event.canExecute = fileManager.document.queryCommandEnabled(
|
| @@ -242,14 +242,14 @@ CommandUtil.createVolumeSwitchCommand = function(index) {
|
| return /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| fileManager.directoryTree.activateByIndex(index - 1);
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| event.canExecute = index > 0 &&
|
| @@ -312,15 +312,15 @@ CommandUtil.shouldShowMenuItemForEntry = function(volumeManager, entry) {
|
|
|
| /**
|
| * Handle of the command events.
|
| - * @param {!FileManager} fileManager FileManager.
|
| + * @param {!CommandHandlerDeps} fileManager Classes |CommandHalder| depends.
|
| * @param {!FileSelectionHandler} selectionHandler
|
| * @constructor
|
| * @struct
|
| */
|
| var CommandHandler = function(fileManager, selectionHandler) {
|
| /**
|
| - * FileManager.
|
| - * @type {!FileManager}
|
| + * CommandHandlerDeps.
|
| + * @type {!CommandHandlerDeps}
|
| * @private
|
| */
|
| this.fileManager_ = fileManager;
|
| @@ -420,7 +420,7 @@ CommandHandler.COMMANDS_ = {};
|
| CommandHandler.COMMANDS_['unmount'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager The file manager instance.
|
| + * @param {!CommandHandlerDeps} fileManager The file manager instance.
|
| */
|
| execute: function(event, fileManager) {
|
| var errorCallback = function() {
|
| @@ -436,10 +436,7 @@ CommandHandler.COMMANDS_['unmount'] = /** @type {Command} */ ({
|
| return;
|
| }
|
|
|
| - fileManager.volumeManager_.unmount(
|
| - volumeInfo,
|
| - function() {},
|
| - errorCallback);
|
| + fileManager.volumeManager.unmount(volumeInfo, function() {}, errorCallback);
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| @@ -481,7 +478,7 @@ CommandHandler.COMMANDS_['unmount'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['format'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager The file manager instance.
|
| + * @param {!CommandHandlerDeps} fileManager The file manager instance.
|
| */
|
| execute: function(event, fileManager) {
|
| var directoryModel = fileManager.directoryModel;
|
| @@ -503,7 +500,7 @@ CommandHandler.COMMANDS_['format'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager The file manager instance.
|
| + * @param {!CommandHandlerDeps} fileManager The file manager instance.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var directoryModel = fileManager.directoryModel;
|
| @@ -536,7 +533,7 @@ CommandHandler.COMMANDS_['new-folder'] = (function() {
|
|
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| NewFolderCommand.prototype.execute = function(event, fileManager) {
|
| var targetDirectory;
|
| @@ -570,7 +567,7 @@ CommandHandler.COMMANDS_['new-folder'] = (function() {
|
| if (executedFromDirectoryTree) {
|
| directoryTree.updateAndSelectNewDirectory(
|
| targetDirectory, newDirectory);
|
| - fileManager.getDirectoryTreeNamingController().attachAndStart(
|
| + fileManager.directoryTreeNamingController.attachAndStart(
|
| assert(fileManager.ui.directoryTree.selectedItem));
|
| } else {
|
| directoryModel.updateAndSelectNewDirectory(
|
| @@ -618,7 +615,7 @@ CommandHandler.COMMANDS_['new-folder'] = (function() {
|
|
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| NewFolderCommand.prototype.canExecute = function(event, fileManager) {
|
| if (event.target instanceof DirectoryItem ||
|
| @@ -636,10 +633,9 @@ CommandHandler.COMMANDS_['new-folder'] = (function() {
|
| CommandUtil.isRootEntry(fileManager.volumeManager, entry));
|
| } else {
|
| var directoryModel = fileManager.directoryModel;
|
| - event.canExecute = !fileManager.isOnReadonlyDirectory() &&
|
| - !fileManager.namingController.isRenamingInProgress() &&
|
| - !directoryModel.isSearching() &&
|
| - !directoryModel.isScanning();
|
| + event.canExecute = !fileManager.directoryModel.isReadOnly() &&
|
| + !fileManager.namingController.isRenamingInProgress() &&
|
| + !directoryModel.isSearching() && !directoryModel.isScanning();
|
| event.command.setHidden(false);
|
| }
|
| };
|
| @@ -654,7 +650,7 @@ CommandHandler.COMMANDS_['new-folder'] = (function() {
|
| CommandHandler.COMMANDS_['new-window'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| fileManager.backgroundPage.launcher.launchFileManager({
|
| @@ -664,7 +660,7 @@ CommandHandler.COMMANDS_['new-window'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| event.canExecute =
|
| @@ -676,7 +672,7 @@ CommandHandler.COMMANDS_['new-window'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['toggle-hidden-files'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| var isFilterHiddenOn = !fileManager.fileFilter.isFilterHiddenOn();
|
| @@ -685,7 +681,7 @@ CommandHandler.COMMANDS_['toggle-hidden-files'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: CommandUtil.canExecuteAlways
|
| });
|
| @@ -697,7 +693,7 @@ CommandHandler.COMMANDS_['toggle-hidden-files'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['drive-sync-settings'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| // If checked, the sync is disabled.
|
| @@ -708,12 +704,12 @@ CommandHandler.COMMANDS_['drive-sync-settings'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| - event.canExecute = fileManager.shouldShowDriveSettings() &&
|
| - fileManager.volumeManager.getDriveConnectionState().
|
| - hasCellularNetworkAccess;
|
| + event.canExecute = fileManager.directoryModel.isOnDrive() &&
|
| + fileManager.volumeManager.getDriveConnectionState()
|
| + .hasCellularNetworkAccess;
|
| event.command.setHidden(!event.canExecute);
|
| }
|
| });
|
| @@ -725,7 +721,7 @@ CommandHandler.COMMANDS_['drive-sync-settings'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['drive-hosted-settings'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| // If checked, showing drive hosted files is enabled.
|
| @@ -741,10 +737,10 @@ CommandHandler.COMMANDS_['drive-hosted-settings'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| - event.canExecute = fileManager.shouldShowDriveSettings();
|
| + event.canExecute = fileManager.directoryModel.isOnDrive();
|
| event.command.setHidden(!event.canExecute);
|
| }
|
| });
|
| @@ -763,7 +759,7 @@ CommandHandler.COMMANDS_['delete'] = (function() {
|
| DeleteCommand.prototype = {
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| var entries = CommandUtil.getCommandEntries(event.target);
|
| @@ -787,7 +783,7 @@ CommandHandler.COMMANDS_['delete'] = (function() {
|
|
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var entries = CommandUtil.getCommandEntries(event.target);
|
| @@ -807,7 +803,7 @@ CommandHandler.COMMANDS_['delete'] = (function() {
|
|
|
| /**
|
| * @param {!Array<!Entry>} entries
|
| - * @param {!FileManager} fileManager
|
| + * @param {!CommandHandlerDeps} fileManager
|
| * @return {boolean} True if entries contain read only entry.
|
| */
|
| containsReadOnlyEntry_: function(entries, fileManager) {
|
| @@ -828,14 +824,14 @@ CommandHandler.COMMANDS_['delete'] = (function() {
|
| CommandHandler.COMMANDS_['paste'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| fileManager.document.execCommand(event.command.id);
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var fileTransferController = fileManager.fileTransferController;
|
| @@ -857,7 +853,7 @@ CommandHandler.COMMANDS_['paste'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['paste-into-folder'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| var entries = CommandUtil.getCommandEntries(event.target);
|
| @@ -879,7 +875,7 @@ CommandHandler.COMMANDS_['paste-into-folder'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var entries = CommandUtil.getCommandEntries(event.target);
|
| @@ -911,24 +907,24 @@ CommandHandler.COMMANDS_['copy'] = CommandUtil.defaultCommand;
|
| CommandHandler.COMMANDS_['rename'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| if (event.target instanceof DirectoryTree) {
|
| var directoryTree = event.target;
|
| - assert(fileManager.getDirectoryTreeNamingController()).attachAndStart(
|
| - assert(directoryTree.selectedItem));
|
| + assert(fileManager.directoryTreeNamingController)
|
| + .attachAndStart(assert(directoryTree.selectedItem));
|
| } else if (event.target instanceof DirectoryItem) {
|
| var directoryItem = event.target;
|
| - assert(fileManager.getDirectoryTreeNamingController()).attachAndStart(
|
| - directoryItem);
|
| + assert(fileManager.directoryTreeNamingController)
|
| + .attachAndStart(directoryItem);
|
| } else {
|
| fileManager.namingController.initiateRename();
|
| }
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var entries = CommandUtil.getCommandEntries(event.target);
|
| @@ -957,17 +953,17 @@ CommandHandler.COMMANDS_['rename'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['volume-help'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| - if (fileManager.isOnDrive())
|
| + if (fileManager.directoryModel.isOnDrive())
|
| util.visitURL(str('GOOGLE_DRIVE_HELP_URL'));
|
| else
|
| util.visitURL(str('FILES_APP_HELP_URL'));
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| // Hides the help menu in modal dialog mode. It does not make much sense
|
| @@ -978,7 +974,7 @@ CommandHandler.COMMANDS_['volume-help'] = /** @type {Command} */ ({
|
| var hideHelp = DialogType.isModal(fileManager.dialogType);
|
| event.canExecute = !hideHelp;
|
| event.command.setHidden(hideHelp);
|
| - fileManager.document_.getElementById('help-separator').hidden = hideHelp;
|
| + fileManager.document.getElementById('help-separator').hidden = hideHelp;
|
| }
|
| });
|
|
|
| @@ -989,7 +985,7 @@ CommandHandler.COMMANDS_['volume-help'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['drive-buy-more-space'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| util.visitURL(str('GOOGLE_DRIVE_BUY_STORAGE_URL'));
|
| @@ -1004,7 +1000,7 @@ CommandHandler.COMMANDS_['drive-buy-more-space'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['drive-go-to-drive'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| util.visitURL(str('GOOGLE_DRIVE_ROOT_URL'));
|
| @@ -1034,7 +1030,7 @@ CommandHandler.COMMANDS_['default-task'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['open-with'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| fileManager.taskController.getFileTasks().then(function(tasks) {
|
| @@ -1053,7 +1049,7 @@ CommandHandler.COMMANDS_['open-with'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var canExecute = fileManager.taskController.canExecuteMoreActions();
|
| @@ -1069,7 +1065,7 @@ CommandHandler.COMMANDS_['open-with'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['get-info'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager fileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager fileManager to use.
|
| */
|
| execute: function(event, fileManager) {
|
| // 'get-info' command is executed by 'command' event handler in
|
| @@ -1077,7 +1073,7 @@ CommandHandler.COMMANDS_['get-info'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var entries = CommandUtil.getCommandEntries(event.target);
|
| @@ -1099,7 +1095,7 @@ CommandHandler.COMMANDS_['get-info'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['search'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| // Cancel item selection.
|
| @@ -1112,7 +1108,7 @@ CommandHandler.COMMANDS_['search'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| event.canExecute = !fileManager.namingController.isRenamingInProgress();
|
| @@ -1149,7 +1145,7 @@ CommandHandler.COMMANDS_['volume-switch-9'] =
|
| CommandHandler.COMMANDS_['toggle-pinned'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event
|
| - * @param {!FileManager} fileManager
|
| + * @param {!CommandHandlerDeps} fileManager
|
| */
|
| execute: function(event, fileManager) {
|
| var actionsModel = fileManager.actionsController.getActionsModelFor(
|
| @@ -1166,7 +1162,7 @@ CommandHandler.COMMANDS_['toggle-pinned'] = /** @type {Command} */ ({
|
|
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var actionsModel = fileManager.actionsController.getActionsModelFor(
|
| @@ -1194,29 +1190,27 @@ CommandHandler.COMMANDS_['toggle-pinned'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['zip-selection'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| var dirEntry = fileManager.getCurrentDirectoryEntry();
|
| if (!dirEntry)
|
| return;
|
| var selectionEntries = fileManager.getSelection().entries;
|
| - fileManager.fileOperationManager_.zipSelection(
|
| + fileManager.fileOperationManager.zipSelection(
|
| /** @type {!DirectoryEntry} */ (dirEntry), selectionEntries);
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var dirEntry = fileManager.getCurrentDirectoryEntry();
|
| var selection = fileManager.getSelection();
|
| - event.canExecute =
|
| - dirEntry &&
|
| - !fileManager.isOnReadonlyDirectory() &&
|
| - !fileManager.isOnDrive() &&
|
| - !fileManager.isOnMTP() &&
|
| - selection && selection.totalCount > 0;
|
| + event.canExecute = dirEntry && !fileManager.directoryModel.isReadOnly() &&
|
| + !fileManager.directoryModel.isOnDrive() &&
|
| + !fileManager.directoryModel.isOnMTP() && selection &&
|
| + selection.totalCount > 0;
|
| }
|
| });
|
|
|
| @@ -1227,7 +1221,7 @@ CommandHandler.COMMANDS_['zip-selection'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['share'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| // To toolbar buttons are always related to the file list, even though the
|
| @@ -1242,7 +1236,7 @@ CommandHandler.COMMANDS_['share'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var actionsModel = fileManager.actionsController.getActionsModelForContext(
|
| @@ -1264,7 +1258,7 @@ CommandHandler.COMMANDS_['share'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['create-folder-shortcut'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager The file manager instance.
|
| + * @param {!CommandHandlerDeps} fileManager The file manager instance.
|
| */
|
| execute: function(event, fileManager) {
|
| var actionsModel = fileManager.actionsController.getActionsModelFor(
|
| @@ -1276,7 +1270,7 @@ CommandHandler.COMMANDS_['create-folder-shortcut'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var actionsModel = fileManager.actionsController.getActionsModelFor(
|
| @@ -1296,7 +1290,7 @@ CommandHandler.COMMANDS_['create-folder-shortcut'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['remove-folder-shortcut'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager The file manager instance.
|
| + * @param {!CommandHandlerDeps} fileManager The file manager instance.
|
| */
|
| execute: function(event, fileManager) {
|
| var actionsModel = fileManager.actionsController.getActionsModelFor(
|
| @@ -1308,7 +1302,7 @@ CommandHandler.COMMANDS_['remove-folder-shortcut'] = /** @type {Command} */ ({
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| var actionsModel = fileManager.actionsController.getActionsModelFor(
|
| @@ -1328,7 +1322,7 @@ CommandHandler.COMMANDS_['remove-folder-shortcut'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['zoom-in'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| chrome.fileManagerPrivate.zoom('in');
|
| @@ -1343,7 +1337,7 @@ CommandHandler.COMMANDS_['zoom-in'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['zoom-out'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| chrome.fileManagerPrivate.zoom('out');
|
| @@ -1358,7 +1352,7 @@ CommandHandler.COMMANDS_['zoom-out'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['zoom-reset'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| chrome.fileManagerPrivate.zoom('reset');
|
| @@ -1421,7 +1415,7 @@ CommandHandler.COMMANDS_['sort-by-date'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['inspect-normal'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| chrome.fileManagerPrivate.openInspector('normal');
|
| @@ -1436,7 +1430,7 @@ CommandHandler.COMMANDS_['inspect-normal'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['inspect-console'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| chrome.fileManagerPrivate.openInspector('console');
|
| @@ -1451,7 +1445,7 @@ CommandHandler.COMMANDS_['inspect-console'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['inspect-element'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| chrome.fileManagerPrivate.openInspector('element');
|
| @@ -1466,7 +1460,7 @@ CommandHandler.COMMANDS_['inspect-element'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['inspect-background'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| chrome.fileManagerPrivate.openInspector('background');
|
| @@ -1481,7 +1475,7 @@ CommandHandler.COMMANDS_['inspect-background'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['install-new-extension'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| fileManager.ui.suggestAppsDialog.showProviders(
|
| @@ -1505,14 +1499,14 @@ CommandHandler.COMMANDS_['install-new-extension'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['open-gear-menu'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| fileManager.ui.gearButton.showMenu(true);
|
| },
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| canExecute: function(event, fileManager) {
|
| event.canExecute = CommandUtil.canExecuteAlways;
|
| @@ -1525,7 +1519,7 @@ CommandHandler.COMMANDS_['open-gear-menu'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['configure'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| var volumeInfo =
|
| @@ -1549,7 +1543,7 @@ CommandHandler.COMMANDS_['configure'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['refresh'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| fileManager.directoryModel.rescan(true /* refresh */);
|
| @@ -1571,7 +1565,7 @@ CommandHandler.COMMANDS_['refresh'] = /** @type {Command} */ ({
|
| CommandHandler.COMMANDS_['set-wallpaper'] = /** @type {Command} */ ({
|
| /**
|
| * @param {!Event} event Command event.
|
| - * @param {!FileManager} fileManager FileManager to use.
|
| + * @param {!CommandHandlerDeps} fileManager CommandHandlerDeps to use.
|
| */
|
| execute: function(event, fileManager) {
|
| var entry = fileManager.getSelection().entries[0];
|
|
|