| Index: chrome/browser/resources/file_manager/js/file_manager.js
|
| diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
|
| index bd5e5c03a9d89a004718514363bbff4928c52c5c..d44aa829542f0b376a9a7daaae47bb5088e52d89 100644
|
| --- a/chrome/browser/resources/file_manager/js/file_manager.js
|
| +++ b/chrome/browser/resources/file_manager/js/file_manager.js
|
| @@ -2509,14 +2509,20 @@ FileManager.prototype = {
|
| FileManager.prototype.selectEntry = function(name) {
|
| for (var i = 0; i < this.dataModel_.length; i++) {
|
| if (this.dataModel_.item(i).name == name) {
|
| - this.currentList_.selectionModel.selectedIndex = i;
|
| - this.currentList_.scrollIndexIntoView(i);
|
| - this.currentList_.focus();
|
| + this.selectIndex(i);
|
| return;
|
| }
|
| }
|
| };
|
|
|
| + FileManager.prototype.selectIndex = function(index) {
|
| + this.currentList_.focus();
|
| + if (index >= this.dataModel_.length)
|
| + return;
|
| + this.currentList_.selectionModel.selectedIndex = index;
|
| + this.currentList_.scrollIndexIntoView(index);
|
| + };
|
| +
|
| /**
|
| * Add the file/directory with given name to the current selection.
|
| *
|
| @@ -2649,6 +2655,8 @@ FileManager.prototype = {
|
| // Directory didn't actually change.
|
| if (opt_selectedEntry)
|
| this.selectEntry(opt_selectedEntry);
|
| + else
|
| + this.selectIndex(0);
|
| return;
|
| }
|
|
|
| @@ -3066,6 +3074,8 @@ FileManager.prototype = {
|
| this.rescanDirectory_(function() {
|
| if (event.selectedEntry)
|
| self.selectEntry(event.selectedEntry);
|
| + else
|
| + self.selectIndex(0);
|
| if (event.opt_callback) {
|
| try {
|
| event.opt_callback();
|
|
|