Commit 71712ae1 authored by yawano's avatar yawano Committed by Commit bot

Disable zip selection on MTP volume.

BUG=486397
TEST=manually tested; Right click a folder on MTP volume, and confirmed that zip selection is disabled.

Review URL: https://codereview.chromium.org/1138973002

Cr-Commit-Position: refs/heads/master@{#329626}
parent 93178c5d
......@@ -179,13 +179,29 @@ DirectoryModel.prototype.isSearching = function() {
};
/**
* @return {boolean}
* @return {boolean} True if it's on Drive.
*/
DirectoryModel.prototype.isOnDrive = function() {
return this.isCurrentRootVolumeType_(VolumeManagerCommon.VolumeType.DRIVE);
};
/**
* @return {boolean} True if it's on MTP volume.
*/
DirectoryModel.prototype.isOnMTP = function() {
return this.isCurrentRootVolumeType_(VolumeManagerCommon.VolumeType.MTP);
};
/**
* @param {VolumeManagerCommon.VolumeType} volumeType Volume Type
* @return {boolean} True if current root volume type is equal to specified
* volume type.
* @private
*/
DirectoryModel.prototype.isCurrentRootVolumeType_ = function(volumeType) {
var rootType = this.getCurrentRootType();
return rootType != null &&
VolumeManagerCommon.getVolumeTypeFromRootType(rootType) ==
VolumeManagerCommon.VolumeType.DRIVE;
VolumeManagerCommon.getVolumeTypeFromRootType(rootType) === volumeType;
};
/**
......
......@@ -1253,6 +1253,13 @@ FileManager.prototype = /** @struct */ {
return this.directoryModel_.isOnDrive();
};
/**
* @return {boolean} True if the current directory content is from MTP volume.
*/
FileManager.prototype.isOnMTP = function() {
return this.directoryModel_.isOnMTP();
};
/**
* Check if the drive-related setting items should be shown on currently
* displayed gear menu.
......
......@@ -1024,6 +1024,7 @@ CommandHandler.COMMANDS_['zip-selection'] = /** @type {Command} */ ({
dirEntry &&
!fileManager.isOnReadonlyDirectory() &&
!fileManager.isOnDrive() &&
!fileManager.isOnMTP() &&
selection && selection.totalCount > 0;
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment