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 /** | 5 /** |
6 * Sets 'hidden' property of a cr.ui.Command instance and dispatches | 6 * Sets 'hidden' property of a cr.ui.Command instance and dispatches |
7 * 'hiddenChange' event manually so that associated cr.ui.MenuItem can handle | 7 * 'hiddenChange' event manually so that associated cr.ui.MenuItem can handle |
8 * the event. | 8 * the event. |
9 * TODO(fukino): Remove this workaround when crbug.com/481941 is fixed. | 9 * TODO(fukino): Remove this workaround when crbug.com/481941 is fixed. |
10 * | 10 * |
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 * @param {!FileManager} fileManager FileManager to use. | 1051 * @param {!FileManager} fileManager FileManager to use. |
1052 */ | 1052 */ |
1053 canExecute: function(event, fileManager) { | 1053 canExecute: function(event, fileManager) { |
1054 var canExecute = fileManager.taskController.canExecuteMoreActions(); | 1054 var canExecute = fileManager.taskController.canExecuteMoreActions(); |
1055 event.canExecute = canExecute; | 1055 event.canExecute = canExecute; |
1056 event.command.setHidden(!canExecute); | 1056 event.command.setHidden(!canExecute); |
1057 } | 1057 } |
1058 }); | 1058 }); |
1059 | 1059 |
1060 /** | 1060 /** |
| 1061 * Displays QuickView for current selection. |
| 1062 * @type {Command} |
| 1063 */ |
| 1064 CommandHandler.COMMANDS_['get-info'] = /** @type {Command} */ ({ |
| 1065 /** |
| 1066 * @param {!Event} event Command event. |
| 1067 * @param {!FileManager} fileManager fileManager to use. |
| 1068 */ |
| 1069 execute: function(event, fileManager) { |
| 1070 // 'get-info' command is executed by 'command' event handler in |
| 1071 // QuickViewController. |
| 1072 }, |
| 1073 /** |
| 1074 * @param {!Event} event Command event. |
| 1075 * @param {!FileManager} fileManager FileManager to use. |
| 1076 */ |
| 1077 canExecute: function(event, fileManager) { |
| 1078 var entries = CommandUtil.getCommandEntries(event.target); |
| 1079 if (entries.length === 0) { |
| 1080 event.canExecute = false; |
| 1081 event.command.setHidden(true); |
| 1082 return; |
| 1083 } |
| 1084 |
| 1085 event.canExecute = entries.length === 1; |
| 1086 event.command.setHidden(false); |
| 1087 } |
| 1088 }); |
| 1089 |
| 1090 /** |
1061 * Focuses search input box. | 1091 * Focuses search input box. |
1062 * @type {Command} | 1092 * @type {Command} |
1063 */ | 1093 */ |
1064 CommandHandler.COMMANDS_['search'] = /** @type {Command} */ ({ | 1094 CommandHandler.COMMANDS_['search'] = /** @type {Command} */ ({ |
1065 /** | 1095 /** |
1066 * @param {!Event} event Command event. | 1096 * @param {!Event} event Command event. |
1067 * @param {!FileManager} fileManager FileManager to use. | 1097 * @param {!FileManager} fileManager FileManager to use. |
1068 */ | 1098 */ |
1069 execute: function(event, fileManager) { | 1099 execute: function(event, fileManager) { |
1070 // Cancel item selection. | 1100 // Cancel item selection. |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 if (entries.length !== 1 || type.type !== 'image') { | 1613 if (entries.length !== 1 || type.type !== 'image') { |
1584 event.canExecute = false; | 1614 event.canExecute = false; |
1585 event.command.setHidden(true); | 1615 event.command.setHidden(true); |
1586 return; | 1616 return; |
1587 } | 1617 } |
1588 | 1618 |
1589 event.canExecute = type.subtype === 'JPEG' || type.subtype === 'PNG'; | 1619 event.canExecute = type.subtype === 'JPEG' || type.subtype === 'PNG'; |
1590 event.command.setHidden(false); | 1620 event.command.setHidden(false); |
1591 } | 1621 } |
1592 }); | 1622 }); |
OLD | NEW |