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

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

Issue 749603002: Revert of Refoctoring FileSelection and FileSelectionHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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: 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 1d684d058b15f439d9aaa42e1c71604d8038d61a..3b1bf35ec005fdb4878c5f6583f9f1e2c3cd0d62 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
@@ -107,6 +107,23 @@
};
/**
+ * Returns a single selected/passed entry or null.
+ * @param {!Event} event Command event.
+ * @param {!FileManager} fileManager FileManager to use.
+ * @return {FileEntry} The entry or null.
+ */
+CommandUtil.getSingleEntry = function(event, fileManager) {
+ if (event.target.entry) {
+ return event.target.entry;
+ }
+ var selection = fileManager.getSelection();
+ if (selection.totalCount == 1) {
+ return selection.entries[0];
+ }
+ return null;
+};
+
+/**
* Obtains target entries that can be pinned from the selection.
* If directories are included in the selection, it just returns an empty
* array to avoid confusing because pinning directory is not supported
@@ -219,7 +236,7 @@
return null;
if (!selection.entries[0].isDirectory)
return null;
- return /** @type {!DirectoryEntry} */(selection.entries[0]);
+ return selection.entries[0];
};
/**

Powered by Google App Engine
This is Rietveld 408576698