| Index: chrome/browser/resources/file_manager/js/file_manager_commands.js
|
| diff --git a/chrome/browser/resources/file_manager/js/file_manager_commands.js b/chrome/browser/resources/file_manager/js/file_manager_commands.js
|
| index 9160562b44c77ad82931fbcf05fef42bfe65273f..e4d3b5a5b4e907ca91a8b0777816688281bc90ae 100644
|
| --- a/chrome/browser/resources/file_manager/js/file_manager_commands.js
|
| +++ b/chrome/browser/resources/file_manager/js/file_manager_commands.js
|
| @@ -35,11 +35,21 @@ CommandUtil.getCommandRootType = function(event, rootsList) {
|
| * @param {Event} event Command event to mark.
|
| * @param {FileManager} fileManager FileManager to use.
|
| */
|
| -CommandUtil.canExecuteOnDriveOnly = function(event, fileManager) {
|
| +CommandUtil.canExecuteEnabledOnDriveOnly = function(event, fileManager) {
|
| event.canExecute = fileManager.isOnDrive();
|
| };
|
|
|
| /**
|
| + * Checks if command should be visible on drive.
|
| + * @param {Event} event Command event to mark.
|
| + * @param {FileManager} fileManager FileManager to use.
|
| + */
|
| +CommandUtil.canExecuteVisibleOnDriveOnly = function(event, fileManager) {
|
| + event.canExecute = fileManager.isOnDrive();
|
| + event.command.setHidden(!fileManager.isOnDrive());
|
| +};
|
| +
|
| +/**
|
| * Returns a single selected/passed entry or null.
|
| * @param {Event} event Command event.
|
| * @param {FileManager} fileManager FileManager to use.
|
| @@ -250,7 +260,9 @@ Commands.driveHelpCommand = {
|
| execute: function() {
|
| window.open(FileManager.GOOGLE_DRIVE_HELP, 'help');
|
| },
|
| - canExecute: CommandUtil.canExecuteOnDriveOnly
|
| + canExecute: function(event, fileManager) {
|
| + event.canExecute = true;
|
| + }
|
| };
|
|
|
| /**
|
| @@ -260,7 +272,7 @@ Commands.driveBuySpaceCommand = {
|
| execute: function() {
|
| window.open(FileManager.GOOGLE_DRIVE_BUY_STORAGE, 'buy-more-space');
|
| },
|
| - canExecute: CommandUtil.canExecuteOnDriveOnly
|
| + canExecute: CommandUtil.canExecuteVisibleOnDriveOnly
|
| };
|
|
|
| /**
|
| @@ -270,7 +282,7 @@ Commands.driveClearCacheCommand = {
|
| execute: function() {
|
| chrome.fileBrowserPrivate.clearDriveCache();
|
| },
|
| - canExecute: CommandUtil.canExecuteOnDriveOnly
|
| + canExecute: CommandUtil.canExecuteVisibleOnDriveOnly
|
| };
|
|
|
| /**
|
| @@ -280,7 +292,7 @@ Commands.driveReloadCommand = {
|
| execute: function() {
|
| chrome.fileBrowserPrivate.reloadDrive();
|
| },
|
| - canExecute: CommandUtil.canExecuteOnDriveOnly
|
| + canExecute: CommandUtil.canExecuteVisibleOnDriveOnly
|
| };
|
|
|
| /**
|
| @@ -290,7 +302,7 @@ Commands.driveGoToDriveCommand = {
|
| execute: function() {
|
| window.open(FileManager.GOOGLE_DRIVE_ROOT, 'drive-root');
|
| },
|
| - canExecute: CommandUtil.canExecuteOnDriveOnly
|
| + canExecute: CommandUtil.canExecuteVisibleOnDriveOnly
|
| };
|
|
|
| /**
|
|
|