Chromium Code Reviews| Index: chrome/browser/resources/file_manager/js/directory_model.js |
| =================================================================== |
| --- chrome/browser/resources/file_manager/js/directory_model.js (revision 133663) |
| +++ chrome/browser/resources/file_manager/js/directory_model.js (working copy) |
| @@ -37,7 +37,6 @@ |
| this.currentDirEntry_ = root; |
| this.fileList_.prepareSort = this.prepareSort_.bind(this); |
| - this.autoSelectIndex_ = 0; |
| this.rootsList_ = new cr.ui.ArrayDataModel([]); |
| this.rootsListSelection_ = new cr.ui.ListSingleSelectionModel(); |
| @@ -196,13 +195,6 @@ |
| }; |
| /** |
| - * @param {number} value New auto select index. |
| - */ |
| -DirectoryModel.prototype.setAutoSelectIndex = function(value) { |
| - this.autoSelectIndex_ = value; |
| -}; |
| - |
| -/** |
| * @private |
| * @return {Array.<string>} Names of selected files. |
| */ |
| @@ -653,10 +645,7 @@ |
| * @param {function} opt_OnError Called if failed. |
| */ |
| DirectoryModel.prototype.changeDirectory = function(path, opt_OnError) { |
| - var onDirectoryResolved = function(dirEntry) { |
| - var autoSelect = this.selectIndex.bind(this, this.autoSelectIndex_); |
| - this.changeDirectoryEntry_(dirEntry, autoSelect, false); |
| - }.bind(this); |
| + var onDirectoryResolved = this.changeDirectoryEntry_.bind(this, false); |
| if (this.unmountedGDataEntry_ && |
| DirectoryModel.getRootType(path) == DirectoryModel.RootType.GDATA) { |
| @@ -691,19 +680,14 @@ |
| * changed. |
| * |
| * @private |
| - * @param {DirectoryEntry} dirEntry The absolute path to the new directory. |
| - * @param {function} action Action executed if the directory loads |
| - * successfully. By default selects the first item (unless it's a save |
| - * dialog). |
| * @param {boolean} initial True if it comes from setupPath and |
| * false if caused by an user action. |
| + * @param {DirectoryEntry} dirEntry The absolute path to the new directory. |
|
dgozman
2012/04/24 11:28:28
It's not a path, but an entry.
Oleg Eterevsky
2012/04/24 11:29:50
Done.
|
| */ |
| -DirectoryModel.prototype.changeDirectoryEntry_ = function(dirEntry, action, |
| - initial) { |
| +DirectoryModel.prototype.changeDirectoryEntry_ = function(initial, dirEntry) { |
| var previous = this.currentDirEntry_; |
| this.currentDirEntry_ = dirEntry; |
| function onRescanComplete() { |
| - action(); |
| // For tests that open the dialog to empty directories, everything |
| // is loaded at this point. |
| chrome.test.sendMessage('directory-change-complete'); |
| @@ -749,10 +733,10 @@ |
| opt_pathResolveCallback(baseName, leafName, exists && !overridden); |
| }.bind(this); |
| - var changeDirectoryEntry = function(entry, callback, initial, exists) { |
| + var changeDirectoryEntry = function(entry, initial, exists) { |
| resolveCallback(exists); |
| if (!overridden) |
| - this.changeDirectoryEntry_(entry, callback, initial); |
| + this.changeDirectoryEntry_(initial, entry); |
| }.bind(this); |
| var INITIAL = true; |
| @@ -760,15 +744,10 @@ |
| // Split the dirname from the basename. |
| var ary = path.match(/^(?:(.*)\/)?([^\/]*)$/); |
| - var autoSelect = function() { |
| - this.selectIndex(this.autoSelectIndex_); |
| - if (opt_loadedCallback) |
| - opt_loadedCallback(); |
| - }.bind(this); |
| if (!ary) { |
| console.warn('Unable to split default path: ' + path); |
| - changeDirectoryEntry(this.root_, autoSelect, INITIAL, !EXISTS); |
| + changeDirectoryEntry(this.root_, INITIAL, !EXISTS); |
| return; |
| } |
| @@ -779,7 +758,7 @@ |
| if (leafEntry.isDirectory) { |
| baseName = path; |
| leafName = ''; |
| - changeDirectoryEntry(leafEntry, autoSelect, INITIAL, EXISTS); |
| + changeDirectoryEntry(leafEntry, INITIAL, EXISTS); |
| return; |
| } |
| @@ -801,7 +780,7 @@ |
| // Usually, leaf does not exist, because it's just a suggested file name. |
| if (err.code != FileError.NOT_FOUND_ERR) |
| console.log('Unexpected error resolving default leaf: ' + err); |
| - changeDirectoryEntry(baseDirEntry, autoSelect, INITIAL, !EXISTS); |
| + changeDirectoryEntry(baseDirEntry, INITIAL, !EXISTS); |
| } |
| var onBaseError = function(err) { |
| @@ -822,7 +801,7 @@ |
| var onBaseFound = function(baseDirEntry) { |
| if (!leafName) { |
| // Default path is just a directory, cd to it and we're done. |
| - changeDirectoryEntry(baseDirEntry, autoSelect, INITIAL, !EXISTS); |
| + changeDirectoryEntry(baseDirEntry, INITIAL, !EXISTS); |
| return; |
| } |