summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrginda@chromium.org <rginda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-21 19:11:21 +0000
committerrginda@chromium.org <rginda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-21 19:11:21 +0000
commit997dcc4335182e41d22938a41d437eac905e1dd8 (patch)
treee1e4e711c7a772c0d9bbc3f94101f8d07a02d5be
parent564e40d0a0fdd1a05fda979ec3f6bfa36a621be1 (diff)
downloadchromium_src-997dcc4335182e41d22938a41d437eac905e1dd8.zip
chromium_src-997dcc4335182e41d22938a41d437eac905e1dd8.tar.gz
chromium_src-997dcc4335182e41d22938a41d437eac905e1dd8.tar.bz2
file manager: misc fixes
* Scope the keydown handler to the list control, rather than the entire dialog. (bug 16374) * Ignore ESC keypress in full-screen mode (bug 16728). * Fill out the filename dialog based on the leaf name in the defaultPath, even if the path lookup fails. * Fix bug with selection summary where files that hadn't been resolved yet were not counted as part of the selection (which caused troubles keeping the ok button in the proper dis/enabled state). BUG=chromium-os:16374, chromium-os:16728, chromium-os:16774 TEST=manual testing in chromeos-chrome in linux. Review URL: http://codereview.chromium.org/7215002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89875 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/file_manager/js/file_manager.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index 6abedfc..20f94b2 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -508,7 +508,8 @@ FileManager.prototype = {
this.filenameInput_.addEventListener(
'focus', this.onFilenameInputFocus_.bind(this));
- this.dialogDom_.addEventListener('keydown', this.onKeyDown_.bind(this));
+ var listContainer = this.dialogDom_.querySelector('.list-container');
+ listContainer.addEventListener('keydown', this.onListKeyDown_.bind(this));
this.okButton_.addEventListener('click', this.onOk_.bind(this));
this.cancelButton_.addEventListener('click', this.onCancel_.bind(this));
@@ -847,11 +848,11 @@ FileManager.prototype = {
if (err = FileError.NOT_FOUND_ERR) {
// Leaf does not exist, it's just a suggested file name.
self.changeDirectoryEntry(baseDirEntry, CD_NO_HISTORY);
- self.filenameInput_.value = leafName;
} else {
console.log('Unexpected error resolving default leaf: ' + err);
self.changeDirectoryEntry('/', CD_NO_HISTORY);
}
+ self.filenameInput_.value = leafName;
}
self.resolvePath(self.defaultPath_, onLeafFound, onLeafError);
@@ -860,6 +861,7 @@ FileManager.prototype = {
function onBaseError(err) {
console.log('Unexpected error resolving default base: ' + err);
self.changeDirectory('/', CD_NO_HISTORY);
+ self.filenameInput_.value = leafName;
}
this.filesystem_.root.getDirectory(
@@ -1167,6 +1169,7 @@ FileManager.prototype = {
selection.totalCount++;
if (entry.isFile) {
+ selection.fileCount += 1;
if (!('cachedSize_' in entry)) {
// Any file that hasn't been rendered may be missing its cachedSize_
// property. For example, visit a large file list, and press ctrl-a
@@ -1178,7 +1181,6 @@ FileManager.prototype = {
} else {
selection.bytes += entry.cachedSize_;
}
- selection.fileCount += 1;
} else {
selection.directoryCount += 1;
}
@@ -2101,9 +2103,14 @@ FileManager.prototype = {
this.setListType(FileManager.ListType.THUMBNAIL);
};
- FileManager.prototype.onKeyDown_ = function(event) {
- if (event.srcElement.tagName == 'INPUT')
+ /**
+ * KeyDown event handler for the div.list-container element.
+ */
+ FileManager.prototype.onListKeyDown_ = function(event) {
+ if (event.srcElement.tagName == 'INPUT') {
+ // Ignore keydown handler in the rename input box.
return;
+ }
switch (event.keyCode) {
case 8: // Backspace => Up one directory.
@@ -2128,8 +2135,10 @@ FileManager.prototype = {
break;
case 27: // Escape => Cancel dialog.
- event.preventDefault();
- this.onCancel_();
+ if (this.dialogType_ != FileManager.DialogType.FULL_PAGE) {
+ event.preventDefault();
+ this.onCancel_();
+ }
break;
case 32: // Ctrl-Space => New Folder.