Index: ui/file_manager/file_manager/foreground/js/ui/dialog_footer.js |
diff --git a/ui/file_manager/file_manager/foreground/js/ui/dialog_footer.js b/ui/file_manager/file_manager/foreground/js/ui/dialog_footer.js |
index 36a95dc5866d9c8e34ef0f8fbdb3a23ad512639e..34515b2a68c1a1e3c14eac64b034108f06b85594 100644 |
--- a/ui/file_manager/file_manager/foreground/js/ui/dialog_footer.js |
+++ b/ui/file_manager/file_manager/foreground/js/ui/dialog_footer.js |
@@ -71,7 +71,9 @@ function DialogFooter(dialogType, container, filenameInput) { |
DialogFooter.prototype = { |
/** |
- * @return {number} Selected filter index. |
+ * @return {number} Selected filter index. The index is 1 based and 0 means |
+ * 'any file types'. Keep the meaniing consistent with the index passed to |
+ * chrome.fileManagerPrivate.selectFile. |
*/ |
get selectedFilterIndex() { |
return ~~this.fileTypeSelector.value; |
@@ -129,13 +131,6 @@ DialogFooter.getOKButtonLabel_ = function(dialogType) { |
*/ |
DialogFooter.prototype.initFileTypeFilter = function( |
fileTypes, includeAllFiles) { |
- if (includeAllFiles) { |
- var option = document.createElement('option'); |
- option.innerText = str('ALL_FILES_FILTER'); |
- option.value = 0; |
- this.fileTypeSelector.appendChild(option); |
- } |
- |
for (var i = 0; i < fileTypes.length; i++) { |
var fileType = fileTypes[i]; |
var option = document.createElement('option'); |
@@ -171,6 +166,13 @@ DialogFooter.prototype.initFileTypeFilter = function( |
this.fileTypeSelector.appendChild(option); |
} |
+ if (includeAllFiles) { |
+ var option = document.createElement('option'); |
+ option.innerText = str('ALL_FILES_FILTER'); |
+ option.value = 0; |
+ this.fileTypeSelector.appendChild(option); |
+ } |
+ |
var options = this.fileTypeSelector.querySelectorAll('option'); |
if (options.length >= 2) { |
// There is in fact no choice, show the selector. |