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

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

Issue 2253873002: Fix the condition to allow format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 d3658301d913df00a9a97c0af779841d4034f9ee..cf7c001377843cc9e2b163b6666d509e5c43cc37 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
@@ -504,16 +504,17 @@ CommandHandler.COMMANDS_['format'] = /** @type {Command} */ ({
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();
+ // |root| is null for unrecognized volumes. Enable format command for such
+ // volumes.
+ var isUnrecognizedVolume = (root == null);
// See the comment in execute() for why doing this.
if (!root)
root = directoryModel.getCurrentDirEntry();
var location = root && fileManager.volumeManager.getLocationInfo(root);
+ var writable = location && !location.isReadOnly;
var removable = location && location.rootType ===
VolumeManagerCommon.RootType.REMOVABLE;
- event.canExecute = removable && !isReadOnly;
+ event.canExecute = removable && (isUnrecognizedVolume || writable);
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