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

Side by Side Diff: ui/file_manager/file_manager/foreground/js/file_manager_commands.js

Issue 883973002: Move cloud import button to toolbar, make material designey. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test coverage for new command update logic. Fix a type, and undo some early debug code. Created 5 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
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 /** 5 /**
6 * TODO(dzvorygin): Here we use this hack, since 'hidden' is standard 6 * TODO(dzvorygin): Here we use this hack, since 'hidden' is standard
7 * attribute and we can't use it's setter as usual. 7 * attribute and we can't use it's setter as usual.
8 * @param {boolean} value New value of hidden property. 8 * @param {boolean} value New value of hidden property.
9 */ 9 */
10 cr.ui.Command.prototype.setHidden = function(value) { 10 cr.ui.Command.prototype.setHidden = function(value) {
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 fileManager.volumeManager.getDriveConnectionState().type === 1011 fileManager.volumeManager.getDriveConnectionState().type ===
1012 VolumeManagerCommon.DriveConnectionType.OFFLINE; 1012 VolumeManagerCommon.DriveConnectionType.OFFLINE;
1013 event.canExecute = fileManager.isOnDrive() && 1013 event.canExecute = fileManager.isOnDrive() &&
1014 !isDriveOffline && 1014 !isDriveOffline &&
1015 selection && selection.totalCount == 1; 1015 selection && selection.totalCount == 1;
1016 event.command.setHidden(!fileManager.isOnDrive()); 1016 event.command.setHidden(!fileManager.isOnDrive());
1017 } 1017 }
1018 }); 1018 });
1019 1019
1020 /** 1020 /**
1021 * Initiates cloud import.
1022 * @type {Command}
1023 */
1024 CommandHandler.COMMANDS_['cloud-import'] = /** @type {Command} */ ({
1025 /**
1026 * @param {!Event} event Command event.
1027 * @param {!FileManager} fileManager
1028 */
1029 execute: function(event, fileManager) {
1030 console.assert(fileManager.importController !== null);
1031 fileManager.importController.execute();
1032 },
1033 /**
1034 * @param {!Event} event Command event.
1035 * @param {!FileManager} fileManager
1036 */
1037 canExecute: function(event, fileManager) {
1038 if (fileManager.importController) {
1039 var response = fileManager.importController.getCommandUpdate();
1040 event.command.label = response.label;
1041 event.canExecute = response.executable;
1042 event.command.setHidden(!response.visible);
1043 } else {
1044 event.canExecute = false;
1045 event.command.setHidden(true);
1046 }
1047 }
1048 });
1049
1050 /**
1051 * Creates a shortcut of the selected folder (single only). 1021 * Creates a shortcut of the selected folder (single only).
1052 * @type {Command} 1022 * @type {Command}
1053 */ 1023 */
1054 CommandHandler.COMMANDS_['create-folder-shortcut'] = /** @type {Command} */ ({ 1024 CommandHandler.COMMANDS_['create-folder-shortcut'] = /** @type {Command} */ ({
1055 /** 1025 /**
1056 * @param {!Event} event Command event. 1026 * @param {!Event} event Command event.
1057 * @param {!FileManager} fileManager The file manager instance. 1027 * @param {!FileManager} fileManager The file manager instance.
1058 */ 1028 */
1059 execute: function(event, fileManager) { 1029 execute: function(event, fileManager) {
1060 var entry = CommandUtil.getCommandEntry(event.target); 1030 var entry = CommandUtil.getCommandEntry(event.target);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 CommandHandler.COMMANDS_['inspect-background'] = /** @type {Command} */ ({ 1194 CommandHandler.COMMANDS_['inspect-background'] = /** @type {Command} */ ({
1225 /** 1195 /**
1226 * @param {!Event} event Command event. 1196 * @param {!Event} event Command event.
1227 * @param {!FileManager} fileManager FileManager to use. 1197 * @param {!FileManager} fileManager FileManager to use.
1228 */ 1198 */
1229 execute: function(event, fileManager) { 1199 execute: function(event, fileManager) {
1230 chrome.fileManagerPrivate.openInspector('background'); 1200 chrome.fileManagerPrivate.openInspector('background');
1231 }, 1201 },
1232 canExecute: CommandUtil.canExecuteAlways 1202 canExecute: CommandUtil.canExecuteAlways
1233 }); 1203 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698