| Index: ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
|
| diff --git a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
|
| index 109d481be913ae54845aa3b3fe5704ba56dd3c08..c38e6e35db0046e62e2737074a0d3ef1a637d4eb 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
|
| @@ -433,10 +433,13 @@ function VolumeItem(modelItem, tree) {
|
|
|
| item.modelItem_ = modelItem;
|
| item.volumeInfo_ = modelItem.volumeInfo;
|
| -
|
| - // Sets up icons of the item.
|
| item.setupIcon_(item.querySelector('.icon'), item.volumeInfo_);
|
| - item.setupEjectButton_(item.rowElement);
|
| +
|
| + // Attach the "eject" icon if the volume is ejectable.
|
| + if (modelItem.volumeInfo_.source === VolumeManagerCommon.Source.DEVICE ||
|
| + modelItem.volumeInfo_.source === VolumeManagerCommon.Source.FILE) {
|
| + item.setupEjectButton_(item.rowElement);
|
| + }
|
|
|
| // Sets up context menu of the item.
|
| if (tree.contextMenuForRootItems)
|
| @@ -479,8 +482,7 @@ VolumeItem.prototype = {
|
| * @param {!cr.ui.Menu} menu Menu to be set.
|
| */
|
| VolumeItem.prototype.setContextMenu = function(menu) {
|
| - if (this.isRemovable_())
|
| - cr.ui.contextMenuHandler.setContextMenu(this, menu);
|
| + cr.ui.contextMenuHandler.setContextMenu(this, menu);
|
| };
|
|
|
| /**
|
| @@ -509,17 +511,6 @@ VolumeItem.prototype.activate = function() {
|
| };
|
|
|
| /**
|
| - * @return {boolean} True if this volume can be removed by user operation.
|
| - * @private
|
| - */
|
| -VolumeItem.prototype.isRemovable_ = function() {
|
| - var volumeType = this.volumeInfo_.volumeType;
|
| - return volumeType === VolumeManagerCommon.VolumeType.ARCHIVE ||
|
| - volumeType === VolumeManagerCommon.VolumeType.REMOVABLE ||
|
| - volumeType === VolumeManagerCommon.VolumeType.PROVIDED;
|
| -};
|
| -
|
| -/**
|
| * Set up icon of this volume item.
|
| * @param {Element} icon Icon element to be setup.
|
| * @param {VolumeInfo} volumeInfo VolumeInfo determines the icon type.
|
| @@ -548,31 +539,29 @@ VolumeItem.prototype.setupIcon_ = function(icon, volumeInfo) {
|
| * @private
|
| */
|
| VolumeItem.prototype.setupEjectButton_ = function(rowElement) {
|
| - if (this.isRemovable_()) {
|
| - var ejectButton = cr.doc.createElement('div');
|
| - // Block other mouse handlers.
|
| - ejectButton.addEventListener(
|
| - 'mouseup', function(event) { event.stopPropagation() });
|
| - ejectButton.addEventListener(
|
| - 'mousedown', function(event) { event.stopPropagation() });
|
| - ejectButton.className = 'root-eject';
|
| - ejectButton.setAttribute('aria-label', str('UNMOUNT_DEVICE_BUTTON_LABEL'));
|
| - ejectButton.addEventListener('click', function(event) {
|
| - event.stopPropagation();
|
| - var unmountCommand = cr.doc.querySelector('command#unmount');
|
| - // Let's make sure 'canExecute' state of the command is properly set for
|
| - // the root before executing it.
|
| - unmountCommand.canExecuteChange(this);
|
| - unmountCommand.execute(this);
|
| - }.bind(this));
|
| - rowElement.appendChild(ejectButton);
|
| + var ejectButton = cr.doc.createElement('div');
|
| + // Block other mouse handlers.
|
| + ejectButton.addEventListener(
|
| + 'mouseup', function(event) { event.stopPropagation() });
|
| + ejectButton.addEventListener(
|
| + 'mousedown', function(event) { event.stopPropagation() });
|
| + ejectButton.className = 'root-eject';
|
| + ejectButton.setAttribute('aria-label', str('UNMOUNT_DEVICE_BUTTON_LABEL'));
|
| + ejectButton.addEventListener('click', function(event) {
|
| + event.stopPropagation();
|
| + var unmountCommand = cr.doc.querySelector('command#unmount');
|
| + // Let's make sure 'canExecute' state of the command is properly set for
|
| + // the root before executing it.
|
| + unmountCommand.canExecuteChange(this);
|
| + unmountCommand.execute(this);
|
| + }.bind(this));
|
| + rowElement.appendChild(ejectButton);
|
|
|
| - // Add paper-ripple effect on the eject button.
|
| - var ripple = cr.doc.createElement('paper-ripple');
|
| - ripple.setAttribute('fit', '');
|
| - ripple.className = 'circle recenteringTouch';
|
| - ejectButton.appendChild(ripple);
|
| - }
|
| + // Add paper-ripple effect on the eject button.
|
| + var ripple = cr.doc.createElement('paper-ripple');
|
| + ripple.setAttribute('fit', '');
|
| + ripple.className = 'circle recenteringTouch';
|
| + ejectButton.appendChild(ripple);
|
| };
|
|
|
|
|
|
|