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

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

Issue 10559004: [filemanager] Allow user to select current directory when nothing in list is selected. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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: chrome/browser/resources/file_manager/js/file_manager.js
===================================================================
--- chrome/browser/resources/file_manager/js/file_manager.js (revision 142373)
+++ chrome/browser/resources/file_manager/js/file_manager.js (working copy)
@@ -3457,7 +3457,9 @@
var selectable;
if (this.dialogType_ == FileManager.DialogType.SELECT_FOLDER) {
- selectable = this.selection.directoryCount == 1 &&
+ // In SELECT_FOLDER mode, we allow to select current directory
+ // when nothing is selected.
+ selectable = this.selection.directoryCount <= 1 &&
this.selection.fileCount == 0;
} else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) {
selectable = (this.isSelectionAvailable() &&
@@ -4292,6 +4294,18 @@
var files = [];
var selectedIndexes = this.currentList_.selectionModel.selectedIndexes;
+ if (this.dialogType_ == FileManager.DialogType.SELECT_FOLDER &&
+ selectedIndexes.length == 0) {
+ var url = this.getSearchOrCurrentDirectoryURL();
+ var singleSelection = {
+ urls: [url],
+ multiple: false,
+ filterIndex: this.getSelectedFilterIndex_(url)
+ };
+ this.selectFilesAndClose_(singleSelection);
+ return;
+ }
+
// All other dialog types require at least one selected list item.
// The logic to control whether or not the ok button is enabled should
// prevent us from ever getting here, but we sanity check to be sure.
« 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