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

Unified Diff: ui/file_manager/file_manager/foreground/js/file_manager_commands.js

Issue 1243273003: Fix Closure Compiler error which is introduced by crrev.com/1233913010 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/file_manager_commands.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
index 84ea15633ce8b840d01fecff49a6acae8ace5685..c559e22cc2552e06191800352cfee558f4d64965 100644
--- a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
+++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
@@ -657,75 +657,89 @@ CommandHandler.COMMANDS_['drive-hosted-settings'] = /** @type {Command} */ ({
* Deletes selected files.
* @type {Command}
*/
-CommandHandler.COMMANDS_['delete'] = /** @type {Command} */ ({
+CommandHandler.COMMANDS_['delete'] = (function() {
/**
- * @param {!Event} event Command event.
- * @param {!FileManager} fileManager FileManager to use.
+ * @constructor
+ * @implements {Command}
*/
- execute: function(event, fileManager) {
- var entries = CommandUtil.getCommandEntries(event.target);
+ var DeleteCommand = function() {};
- // Execute might be called without a call of canExecute method, e.g. called
- // directly from code. Double check here not to delete undeletable entries.
- if (this.containsFakeOrRootEntry_(entries, fileManager) ||
- this.containsReadOnlyEntry_(entries, fileManager))
- return;
+ DeleteCommand.prototype = {
+ /**
+ * @param {!Event} event Command event.
+ * @param {!FileManager} fileManager FileManager to use.
+ */
+ execute: function(event, fileManager) {
+ var entries = CommandUtil.getCommandEntries(event.target);
+
+ // Execute might be called without a call of canExecute method,
+ // e.g. called directly from code. Double check here not to delete
+ // undeletable entries.
+ if (this.containsFakeOrRootEntry_(entries, fileManager) ||
+ this.containsReadOnlyEntry_(entries, fileManager))
+ return;
+
+ var message = entries.length === 1 ?
+ strf('GALLERY_CONFIRM_DELETE_ONE', entries[0].name) :
+ strf('GALLERY_CONFIRM_DELETE_SOME', entries.length);
+
+ fileManager.ui.deleteConfirmDialog.show(message, function() {
+ fileManager.fileOperationManager.deleteEntries(entries);
+ }, null, null);
+ },
- var message = entries.length === 1 ?
- strf('GALLERY_CONFIRM_DELETE_ONE', entries[0].name) :
- strf('GALLERY_CONFIRM_DELETE_SOME', entries.length);
+ /**
+ * @param {!Event} event Command event.
+ * @param {!FileManager} fileManager FileManager to use.
+ */
+ canExecute: function(event, fileManager) {
+ var entries = CommandUtil.getCommandEntries(event.target);
- fileManager.ui.deleteConfirmDialog.show(message, function() {
- fileManager.fileOperationManager.deleteEntries(entries);
- }, null, null);
- },
- /**
- * @param {!Event} event Command event.
- * @param {!FileManager} fileManager FileManager to use.
- */
- canExecute: function(event, fileManager) {
- var entries = CommandUtil.getCommandEntries(event.target);
+ // If entries contain fake or root entry, hide delete option.
+ if (this.containsFakeOrRootEntry_(entries, fileManager)) {
+ event.canExecute = false;
+ event.command.setHidden(true);
+ return;
+ }
- // If entries contain fake or root entry, hide delete option.
- if (this.containsFakeOrRootEntry_(entries, fileManager)) {
- event.canExecute = false;
- event.command.setHidden(true);
- return;
- }
+ event.canExecute = entries.length > 0 &&
+ !this.containsReadOnlyEntry_(entries, fileManager);
+ event.command.setHidden(false);
+ },
- event.canExecute = entries.length > 0 &&
- !this.containsReadOnlyEntry_(entries, fileManager);
- event.command.setHidden(false);
- },
- /**
- * @param {!Array<!Entry>} entries
- * @param {!FileManager} fileManager
- * @return {boolean} True if entries contain fake or root entry.
- */
- containsFakeOrRootEntry_: function(entries, fileManager) {
- return entries.some(function(entry) {
- if (util.isFakeEntry(entry))
- return true;
+ /**
+ * @param {!Array<!Entry>} entries
+ * @param {!FileManager} fileManager
+ * @return {boolean} True if entries contain fake or root entry.
+ */
+ containsFakeOrRootEntry_: function(entries, fileManager) {
+ return entries.some(function(entry) {
+ if (util.isFakeEntry(entry))
+ return true;
- var volumeInfo = fileManager.volumeManager.getVolumeInfo(entry);
- if (!volumeInfo)
- return true;
+ var volumeInfo = fileManager.volumeManager.getVolumeInfo(entry);
+ if (!volumeInfo)
+ return true;
- return volumeInfo.displayRoot === entry;
- });
- },
- /**
- * @param {!Array<!Entry>} entries
- * @param {!FileManager} fileManager
- * @return {boolean} True if entries contain read only entry.
- */
- containsReadOnlyEntry_: function(entries, fileManager) {
- return entries.some(function(entry) {
- var locationInfo = fileManager.volumeManager.getLocationInfo(entry);
- return locationInfo && locationInfo.isReadOnly;
- });
- }
-});
+ return volumeInfo.displayRoot === entry;
+ });
+ },
+
+ /**
+ * @param {!Array<!Entry>} entries
+ * @param {!FileManager} fileManager
+ * @return {boolean} True if entries contain read only entry.
+ */
+ containsReadOnlyEntry_: function(entries, fileManager) {
+ return entries.some(function(entry) {
+ var locationInfo = fileManager.volumeManager.getLocationInfo(entry);
+ return locationInfo && locationInfo.isReadOnly;
+ });
+ }
+ };
+
+ return new DeleteCommand();
+})();
/**
* Pastes files from clipboard.
@@ -1394,8 +1408,6 @@ CommandHandler.COMMANDS_['configure'] = (function() {
};
ConfigureCommand.prototype = {
- __proto__: Command.prototype,
-
/**
* @param {EventTarget} element
* @param {!FileManager} fileManager
« 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