OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 var CommandUtil = {}; | 7 var CommandUtil = {}; |
8 | 8 |
9 /** | 9 /** |
10 * Extracts entry on which command event was dispatched. | 10 * Extracts entry on which command event was dispatched. |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 if (entry) | 602 if (entry) |
603 fileManager.createFolderShortcut(entry.fullPath); | 603 fileManager.createFolderShortcut(entry.fullPath); |
604 }, | 604 }, |
605 | 605 |
606 /** | 606 /** |
607 * @param {Event} event Command event. | 607 * @param {Event} event Command event. |
608 * @param {FileManager} fileManager The file manager instance. | 608 * @param {FileManager} fileManager The file manager instance. |
609 */ | 609 */ |
610 canExecute: function(event, fileManager) { | 610 canExecute: function(event, fileManager) { |
611 var target = event.target; | 611 var target = event.target; |
612 // TODO(yoshiki): remove this after launching folder shortcuts feature. | 612 if (!target instanceof NavigationListItem && |
613 if (!fileManager.isFolderShortcutsEnabled() || | 613 !target instanceof DirectoryItem) { |
614 (!target instanceof NavigationListItem && | |
615 !target instanceof DirectoryItem)) { | |
616 event.command.setHidden(true); | 614 event.command.setHidden(true); |
617 return; | 615 return; |
618 } | 616 } |
619 | 617 |
620 var entry = CommandUtil.getCommandEntry(event.target); | 618 var entry = CommandUtil.getCommandEntry(event.target); |
621 var folderShortcutExists = entry && | 619 var folderShortcutExists = entry && |
622 fileManager.folderShortcutExists(entry.fullPath); | 620 fileManager.folderShortcutExists(entry.fullPath); |
623 | 621 |
624 var onlyOneFolderSelected = true; | 622 var onlyOneFolderSelected = true; |
625 // Only on list, user can select multiple files. The command is enabled only | 623 // Only on list, user can select multiple files. The command is enabled only |
(...skipping 27 matching lines...) Expand all Loading... |
653 if (path) | 651 if (path) |
654 fileManager.removeFolderShortcut(path); | 652 fileManager.removeFolderShortcut(path); |
655 }, | 653 }, |
656 | 654 |
657 /** | 655 /** |
658 * @param {Event} event Command event. | 656 * @param {Event} event Command event. |
659 * @param {FileManager} fileManager The file manager instance. | 657 * @param {FileManager} fileManager The file manager instance. |
660 */ | 658 */ |
661 canExecute: function(event, fileManager) { | 659 canExecute: function(event, fileManager) { |
662 var target = event.target; | 660 var target = event.target; |
663 // TODO(yoshiki): remove this after launching folder shortcut feature. | 661 if (!target instanceof NavigationListItem && |
664 if (!fileManager.isFolderShortcutsEnabled() || | 662 !target instanceof DirectoryItem) { |
665 (!target instanceof NavigationListItem && | |
666 !target instanceof DirectoryItem)) { | |
667 event.command.setHidden(true); | 663 event.command.setHidden(true); |
668 return; | 664 return; |
669 } | 665 } |
670 | 666 |
671 var entry = CommandUtil.getCommandEntry(target); | 667 var entry = CommandUtil.getCommandEntry(target); |
672 var path = | 668 var path = |
673 entry ? entry.fullPath : CommandUtil.getCommandPath(event.target); | 669 entry ? entry.fullPath : CommandUtil.getCommandPath(event.target); |
674 | 670 |
675 var eligible = path && PathUtil.isEligibleForFolderShortcut(path); | 671 var eligible = path && PathUtil.isEligibleForFolderShortcut(path); |
676 var isShortcut = path && fileManager.folderShortcutExists(path); | 672 var isShortcut = path && fileManager.folderShortcutExists(path); |
(...skipping 24 matching lines...) Expand all Loading... |
701 | 697 |
702 /** | 698 /** |
703 * Reset the zoom factor. | 699 * Reset the zoom factor. |
704 */ | 700 */ |
705 Commands.zoomResetCommand = { | 701 Commands.zoomResetCommand = { |
706 execute: function(event) { | 702 execute: function(event) { |
707 chrome.fileBrowserPrivate.zoom('reset'); | 703 chrome.fileBrowserPrivate.zoom('reset'); |
708 }, | 704 }, |
709 canExecute: CommandUtil.canExecuteAlways | 705 canExecute: CommandUtil.canExecuteAlways |
710 }; | 706 }; |
OLD | NEW |