| 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 /** | 7 /** |
| 8 * TODO(dzvorygin): Here we use this hack, since 'hidden' is standard | 8 * TODO(dzvorygin): Here we use this hack, since 'hidden' is standard |
| 9 * attribute and we can't use it's setter as usual. | 9 * attribute and we can't use it's setter as usual. |
| 10 * @param {boolean} value New value of hidden property. | 10 * @param {boolean} value New value of hidden property. |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 370 } |
| 371 fileManager.volumeManager_.unmount( | 371 fileManager.volumeManager_.unmount( |
| 372 volumeInfo, | 372 volumeInfo, |
| 373 function() {}, | 373 function() {}, |
| 374 errorCallback); | 374 errorCallback); |
| 375 }, | 375 }, |
| 376 /** | 376 /** |
| 377 * @param {Event} event Command event. | 377 * @param {Event} event Command event. |
| 378 */ | 378 */ |
| 379 canExecute: function(event, fileManager) { | 379 canExecute: function(event, fileManager) { |
| 380 var root = CommandUtil.getCommandEntry(this.fileManager_.navigationList); | 380 var root = CommandUtil.getCommandEntry(event.target); |
| 381 var location = | 381 if (!root) |
| 382 root && this.fileManager_.volumeManager.getLocationInfo(root); | 382 return; |
| 383 var rootType = location && location.isRootEntry && location.rootType; | 383 var locationInfo = this.fileManager_.volumeManager.getLocationInfo(root); |
| 384 var rootType = |
| 385 locationInfo && locationInfo.isRootEntry && locationInfo.rootType; |
| 384 | 386 |
| 385 event.canExecute = (rootType == RootType.ARCHIVE || | 387 event.canExecute = (rootType == RootType.ARCHIVE || |
| 386 rootType == RootType.REMOVABLE); | 388 rootType == RootType.REMOVABLE); |
| 387 event.command.setHidden(!event.canExecute); | 389 event.command.setHidden(!event.canExecute); |
| 388 event.command.label = rootType == RootType.ARCHIVE ? | 390 event.command.label = rootType == RootType.ARCHIVE ? |
| 389 str('CLOSE_ARCHIVE_BUTTON_LABEL') : | 391 str('CLOSE_ARCHIVE_BUTTON_LABEL') : |
| 390 str('UNMOUNT_DEVICE_BUTTON_LABEL'); | 392 str('UNMOUNT_DEVICE_BUTTON_LABEL'); |
| 391 } | 393 } |
| 392 }; | 394 }; |
| 393 | 395 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 /** | 839 /** |
| 838 * Reset the zoom factor. | 840 * Reset the zoom factor. |
| 839 * @type {Command} | 841 * @type {Command} |
| 840 */ | 842 */ |
| 841 CommandHandler.COMMANDS_['zoom-reset'] = { | 843 CommandHandler.COMMANDS_['zoom-reset'] = { |
| 842 execute: function(event, fileManager) { | 844 execute: function(event, fileManager) { |
| 843 chrome.fileBrowserPrivate.zoom('reset'); | 845 chrome.fileBrowserPrivate.zoom('reset'); |
| 844 }, | 846 }, |
| 845 canExecute: CommandUtil.canExecuteAlways | 847 canExecute: CommandUtil.canExecuteAlways |
| 846 }; | 848 }; |
| OLD | NEW |