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

Unified Diff: chrome/browser/resources/file_manager/js/file_manager_commands.js

Issue 12221082: Add gear menu to /downloads and /external_storage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/file_manager_commands.js
diff --git a/chrome/browser/resources/file_manager/js/file_manager_commands.js b/chrome/browser/resources/file_manager/js/file_manager_commands.js
index 9160562b44c77ad82931fbcf05fef42bfe65273f..e4d3b5a5b4e907ca91a8b0777816688281bc90ae 100644
--- a/chrome/browser/resources/file_manager/js/file_manager_commands.js
+++ b/chrome/browser/resources/file_manager/js/file_manager_commands.js
@@ -35,11 +35,21 @@ CommandUtil.getCommandRootType = function(event, rootsList) {
* @param {Event} event Command event to mark.
* @param {FileManager} fileManager FileManager to use.
*/
-CommandUtil.canExecuteOnDriveOnly = function(event, fileManager) {
+CommandUtil.canExecuteEnabledOnDriveOnly = function(event, fileManager) {
event.canExecute = fileManager.isOnDrive();
};
/**
+ * Checks if command should be visible on drive.
+ * @param {Event} event Command event to mark.
+ * @param {FileManager} fileManager FileManager to use.
+ */
+CommandUtil.canExecuteVisibleOnDriveOnly = function(event, fileManager) {
+ event.canExecute = fileManager.isOnDrive();
+ event.command.setHidden(!fileManager.isOnDrive());
+};
+
+/**
* Returns a single selected/passed entry or null.
* @param {Event} event Command event.
* @param {FileManager} fileManager FileManager to use.
@@ -250,7 +260,9 @@ Commands.driveHelpCommand = {
execute: function() {
window.open(FileManager.GOOGLE_DRIVE_HELP, 'help');
},
- canExecute: CommandUtil.canExecuteOnDriveOnly
+ canExecute: function(event, fileManager) {
+ event.canExecute = true;
+ }
};
/**
@@ -260,7 +272,7 @@ Commands.driveBuySpaceCommand = {
execute: function() {
window.open(FileManager.GOOGLE_DRIVE_BUY_STORAGE, 'buy-more-space');
},
- canExecute: CommandUtil.canExecuteOnDriveOnly
+ canExecute: CommandUtil.canExecuteVisibleOnDriveOnly
};
/**
@@ -270,7 +282,7 @@ Commands.driveClearCacheCommand = {
execute: function() {
chrome.fileBrowserPrivate.clearDriveCache();
},
- canExecute: CommandUtil.canExecuteOnDriveOnly
+ canExecute: CommandUtil.canExecuteVisibleOnDriveOnly
};
/**
@@ -280,7 +292,7 @@ Commands.driveReloadCommand = {
execute: function() {
chrome.fileBrowserPrivate.reloadDrive();
},
- canExecute: CommandUtil.canExecuteOnDriveOnly
+ canExecute: CommandUtil.canExecuteVisibleOnDriveOnly
};
/**
@@ -290,7 +302,7 @@ Commands.driveGoToDriveCommand = {
execute: function() {
window.open(FileManager.GOOGLE_DRIVE_ROOT, 'drive-root');
},
- canExecute: CommandUtil.canExecuteOnDriveOnly
+ canExecute: CommandUtil.canExecuteVisibleOnDriveOnly
};
/**

Powered by Google App Engine
This is Rietveld 408576698