summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorhirono <hirono@chromium.org>2015-02-03 20:55:24 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-04 04:56:40 +0000
commit13d5f845e78f390c60240de4ca6a04486749c511 (patch)
tree3a59a07c0c1966b8139f163746f1e1d03c2d01dc /ui
parent39f7b287a8ea8400572df707b35309254b168531 (diff)
downloadchromium_src-13d5f845e78f390c60240de4ca6a04486749c511.zip
chromium_src-13d5f845e78f390c60240de4ca6a04486749c511.tar.gz
chromium_src-13d5f845e78f390c60240de4ca6a04486749c511.tar.bz2
Files.app: Move 'any file type' item to the end of filter list.
In the dialog footer, we have a combobox to select a file type. Previously we have 'any file type' at the top of the list and it is selected by default. The CL moves it to the end of the list so that the first type is selected by default. BUG=454418 TEST=None Review URL: https://codereview.chromium.org/898853002 Cr-Commit-Position: refs/heads/master@{#314507}
Diffstat (limited to 'ui')
-rw-r--r--ui/file_manager/file_manager/foreground/js/ui/dialog_footer.js18
1 files changed, 10 insertions, 8 deletions
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 36a95dc..34515b2 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.