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 var CommandUtil = {}; | 5 var CommandUtil = {}; |
6 | 6 |
7 /** | 7 /** |
8 * Extracts root on which command event was dispatched. | 8 * Extracts root on which command event was dispatched. |
9 * | 9 * |
10 * @param {Event} event Command event for which to retrieve root to operate on. | 10 * @param {Event} event Command event for which to retrieve root to operate on. |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 function(task) { | 282 function(task) { |
283 tasks.execute(task.taskId); | 283 tasks.execute(task.taskId); |
284 }); | 284 }); |
285 } | 285 } |
286 }, | 286 }, |
287 canExecute: function(event, fileManager) { | 287 canExecute: function(event, fileManager) { |
288 var tasks = fileManager.getSelection().tasks; | 288 var tasks = fileManager.getSelection().tasks; |
289 event.canExecute = tasks && tasks.size() > 1; | 289 event.canExecute = tasks && tasks.size() > 1; |
290 } | 290 } |
291 }; | 291 }; |
| 292 |
| 293 /** |
| 294 * Creates zip file for current selection. |
| 295 */ |
| 296 Commands.zipSelectionCommand = { |
| 297 execute: function(event, fileManager) { |
| 298 var dirEntry = fileManager.directoryModel_.getCurrentDirEntry(); |
| 299 var selectionEntries = fileManager.getSelection().entries; |
| 300 fileManager.copyManager_.zipSelection(dirEntry, fileManager.isOnGData(), |
| 301 selectionEntries); |
| 302 }, |
| 303 canExecute: function(event, fileManager) { |
| 304 var selection = fileManager.getSelection(); |
| 305 event.canExecute = !fileManager.isOnGData() && selection && |
| 306 selection.totalCount > 0; |
| 307 } |
| 308 }; |
OLD | NEW |