Commit 3ea28302 authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

[Files.app] Remove CommandUtil.getCommandPath()

This patch is almost a revert of crrev.com/219997.

CommandUtil.getCommandPath() is no longer necessary because the patch for M30 has been merged successfully and the unavailable shortcut would been automatically removed.

BUG=287597, 284921
TEST=manually tested
R=hirono@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222176 0039d316-1c4b-4281-b951-d872f2087c98
parent 49cdfde5
...@@ -47,35 +47,6 @@ CommandUtil.getCommandEntry = function(element) { ...@@ -47,35 +47,6 @@ CommandUtil.getCommandEntry = function(element) {
} }
}; };
/**
* Extracts path on which command event was dispatched.
* TODO(yoshiki): Remove this method after adding automatically removing an
* inactive shortcut on M31.
*
* @param {NavigationList|NavigationListItem} element Directory to extract a
* path from.
* @return {string} Path of the found node.
*/
CommandUtil.getCommandPath = function(element) {
if (element instanceof NavigationList) {
// element is a NavigationList.
/** @type {NavigationModelItem} */
var selectedItem = element.selectedItem;
return selectedItem && selectedItem.path;
} else if (element instanceof NavigationListItem) {
// element is a subitem of NavigationList.
/** @type {NavigationList} */
var navigationList = element.parentElement;
var index = navigationList.getIndexOfListItem(element);
/** @type {NavigationModelItem} */
var item = (index != -1) ? navigationList.dataModel.item(index) : null;
return item && item.path;
}
console.error('Unsupported element.');
};
/** /**
* @param {NavigationList} navigationList navigation list to extract root node. * @param {NavigationList} navigationList navigation list to extract root node.
* @return {?RootType} Type of the found root. * @return {?RootType} Type of the found root.
...@@ -646,10 +617,8 @@ Commands.removeFolderShortcutCommand = { ...@@ -646,10 +617,8 @@ Commands.removeFolderShortcutCommand = {
*/ */
execute: function(event, fileManager) { execute: function(event, fileManager) {
var entry = CommandUtil.getCommandEntry(event.target); var entry = CommandUtil.getCommandEntry(event.target);
var path = if (entry && entry.fullPath)
entry ? entry.fullPath : CommandUtil.getCommandPath(event.target); fileManager.removeFolderShortcut(entry.fullPath);
if (path)
fileManager.removeFolderShortcut(path);
}, },
/** /**
...@@ -665,8 +634,7 @@ Commands.removeFolderShortcutCommand = { ...@@ -665,8 +634,7 @@ Commands.removeFolderShortcutCommand = {
} }
var entry = CommandUtil.getCommandEntry(target); var entry = CommandUtil.getCommandEntry(target);
var path = var path = entry && entry.fullPath;
entry ? entry.fullPath : CommandUtil.getCommandPath(event.target);
var eligible = path && PathUtil.isEligibleForFolderShortcut(path); var eligible = path && PathUtil.isEligibleForFolderShortcut(path);
var isShortcut = path && fileManager.folderShortcutExists(path); var isShortcut = path && fileManager.folderShortcutExists(path);
......
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