Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: chrome/browser/resources/file_manager/foreground/js/file_manager_commands.js

Issue 131103020: Fix ejecting if the element is not selected. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698