Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1263)

Unified Diff: ui/file_manager/file_manager/foreground/js/file_manager_commands.js

Issue 386333002: Files.app: Disable formatting menu for read only volumes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 937ff593f7a055ac972c28ee2deac0726e28420f..729e738b7af7fc6bc902992bda9c3d3659d353da 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);
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698