Chromium Code Reviews| 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 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1417 canExecute: function(event, fileManager) { | 1417 canExecute: function(event, fileManager) { |
| 1418 var volumeInfo = this.getCommandVolumeInfo_(event, fileManager); | 1418 var volumeInfo = this.getCommandVolumeInfo_(event, fileManager); |
| 1419 event.canExecute = volumeInfo && volumeInfo.configurable; | 1419 event.canExecute = volumeInfo && volumeInfo.configurable; |
| 1420 event.command.setHidden(!event.canExecute); | 1420 event.command.setHidden(!event.canExecute); |
| 1421 } | 1421 } |
| 1422 }; | 1422 }; |
| 1423 | 1423 |
| 1424 return new ConfigureCommand(); | 1424 return new ConfigureCommand(); |
| 1425 })(); | 1425 })(); |
| 1426 | 1426 |
| 1427 /** | |
| 1428 * Refreshes the currently selected directory. | |
| 1429 */ | |
| 1430 CommandHandler.COMMANDS_['refresh'] = /** @type {Command} */ ({ | |
| 1431 /** | |
| 1432 * @param {!Event} event Command event. | |
| 1433 * @param {!FileManager} fileManager FileManager to use. | |
| 1434 */ | |
| 1435 execute: function(event, fileManager) { | |
| 1436 // TODO(mtomasz): Implement refreshing. | |
| 1437 }, | |
| 1438 canExecute: function(event, fileManager) { | |
| 1439 var currentDirEntry = fileManager.directoryModel.getCurrentDirEntry(); | |
| 1440 var volumeInfo = fileManager.volumeManager.getVolumeInfo(currentDirEntry); | |
| 1441 event.canExecute = !volumeInfo.watchable; | |
|
fukino
2015/07/01 10:39:33
Could you add null check as volumeInfo can be null
mtomasz
2015/07/02 08:52:40
Done.
| |
| 1442 event.command.setHidden(!event.canExecute || | |
| 1443 fileManager.directoryModel.getFileListSelection().getCheckSelectMode()); | |
| 1444 } | |
| 1445 }); | |
| OLD | NEW |