diff options
author | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-14 06:46:11 +0000 |
---|---|---|
committer | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-14 06:46:11 +0000 |
commit | ea7cef28b18d91b13949e124952b2b7d41e539e9 (patch) | |
tree | 6a331ae913d4a395f19a31001712751212c7136f /ui | |
parent | 1c9fe77b99fffb9096e9aae91ec35209f0380b85 (diff) | |
download | chromium_src-ea7cef28b18d91b13949e124952b2b7d41e539e9.zip chromium_src-ea7cef28b18d91b13949e124952b2b7d41e539e9.tar.gz chromium_src-ea7cef28b18d91b13949e124952b2b7d41e539e9.tar.bz2 |
Files.app: Disable formatting menu for read only volumes.
The purpose of this change is to disable the menu for write-protected
SD cards that anyhow fails to format.
Strictly speaking this is excessive, because there may be a volume with
read-only file system that still is formattable. We however assume that
the practical need for the case is low (see discussion in the BUG.)
BUG=334108
Review URL: https://codereview.chromium.org/386333002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282907 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/file_manager/file_manager/foreground/js/file_manager_commands.js | 8 |
1 files changed, 4 insertions, 4 deletions
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 937ff59..729e738 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 @@ -417,16 +417,16 @@ CommandHandler.COMMANDS_['format'] = { canExecute: function(event, fileManager) { var directoryModel = fileManager.directoryModel; var root = CommandUtil.getCommandEntry(event.target); + // |root| is null for unrecognized volumes. Regard such volumes as writable + // so that the format command is enabled. + var isReadOnly = root && fileManager.isOnReadonlyDirectory(); // See the comment in execute() for why doing this. if (!root) root = directoryModel.getCurrentDirEntry(); var location = root && fileManager.volumeManager.getLocationInfo(root); var removable = location && location.rootType === VolumeManagerCommon.RootType.REMOVABLE; - // Don't check if the volume is read-only. Unformatted volume is considered - // read-only per VolumeInfo.isReadOnly, but can be formatted. An error will - // be raised if formatting failed anyway. - event.canExecute = removable; + event.canExecute = removable && !isReadOnly; event.command.setHidden(!removable); } }; |