| Index: chrome/browser/resources/file_manager/js/directory_model.js
|
| diff --git a/chrome/browser/resources/file_manager/js/directory_model.js b/chrome/browser/resources/file_manager/js/directory_model.js
|
| index c41990ffd07093caadb4c101fa437ab43d4be1d6..0e69845503f7cbb1b28d348ad5b67421a21ac9a9 100644
|
| --- a/chrome/browser/resources/file_manager/js/directory_model.js
|
| +++ b/chrome/browser/resources/file_manager/js/directory_model.js
|
| @@ -38,19 +38,6 @@ function DirectoryModel(root, singleSelection,
|
| this.currentFileListContext_, root);
|
|
|
| this.rootsList_ = new cr.ui.ArrayDataModel([]);
|
| - this.rootsListSelection_ = new cr.ui.ListSingleSelectionModel();
|
| - this.rootsListSelection_.addEventListener(
|
| - 'change', this.onRootChange_.bind(this));
|
| -
|
| - this.rootsListSelection_.addEventListener(
|
| - 'beforeChange', this.onBeforeRootChange_.bind(this));
|
| -
|
| - /**
|
| - * A map root.fullPath -> currentDirectory.fullPath.
|
| - * @type {Object.<string, string>}
|
| - * @private
|
| - */
|
| - this.currentDirByRoot_ = {};
|
|
|
| this.volumeManager_ = volumeManager;
|
| }
|
| @@ -341,13 +328,6 @@ DirectoryModel.prototype.getRootsList = function() {
|
| };
|
|
|
| /**
|
| - * @return {cr.ui.ListSingleSelectionModel} Root list selection model.
|
| - */
|
| -DirectoryModel.prototype.getRootsListSelectionModel = function() {
|
| - return this.rootsListSelection_;
|
| -};
|
| -
|
| -/**
|
| * Schedule rescan with short delay.
|
| */
|
| DirectoryModel.prototype.rescanSoon = function() {
|
| @@ -746,53 +726,6 @@ DirectoryModel.prototype.resolveDirectory = function(path, successCallback,
|
| };
|
|
|
| /**
|
| - * @return {Entry} Directory entry of the root selected in rootsList.
|
| - * @private
|
| - */
|
| -DirectoryModel.prototype.getSelectedRootDirEntry_ = function() {
|
| - return this.rootsList_.item(this.rootsListSelection_.selectedIndex);
|
| -};
|
| -
|
| -/**
|
| - * Handler before root item change.
|
| - * @param {Event} event The event.
|
| - * @private
|
| - */
|
| -DirectoryModel.prototype.onBeforeRootChange_ = function(event) {
|
| - if (event.changes.length == 1 && !event.changes[0].selected)
|
| - event.preventDefault();
|
| -};
|
| -
|
| -/**
|
| - * Handler for root item being clicked.
|
| - * @param {Event} event The event.
|
| - * @private
|
| - */
|
| -DirectoryModel.prototype.onRootChange_ = function(event) {
|
| - var newRootDir = this.getSelectedRootDirEntry_();
|
| - if (newRootDir)
|
| - this.changeRoot(newRootDir.fullPath);
|
| -};
|
| -
|
| -/**
|
| - * Changes directory. If path points to a root (except current one)
|
| - * then directory changed to the last used one for the root.
|
| - *
|
| - * @param {string} path New current directory path or new root.
|
| - */
|
| -DirectoryModel.prototype.changeRoot = function(path) {
|
| - var currentDir = this.currentDirByRoot_[path] || path;
|
| - if (currentDir == this.getCurrentDirPath())
|
| - return;
|
| - var onError = path != currentDir && path != this.getCurrentDirPath() ?
|
| - this.changeDirectory.bind(this, path) : null;
|
| - this.resolveDirectory(
|
| - currentDir,
|
| - this.changeDirectoryEntry_.bind(this, false),
|
| - onError);
|
| -};
|
| -
|
| -/**
|
| * @param {DirectoryEntry} dirEntry The absolute path to the new directory.
|
| * @param {function=} opt_callback Executed if the directory loads successfully.
|
| * @private
|
| @@ -809,8 +742,6 @@ DirectoryModel.prototype.changeDirectoryEntrySilent_ = function(dirEntry,
|
| this.clearAndScan_(new DirectoryContentsBasic(this.currentFileListContext_,
|
| dirEntry),
|
| onScanComplete.bind(this));
|
| - this.currentDirByRoot_[this.getCurrentRootPath()] = dirEntry.fullPath;
|
| - this.updateRootsListSelection_();
|
| };
|
|
|
| /**
|
| @@ -1098,10 +1029,12 @@ DirectoryModel.prototype.resolveRoots_ = function(callback) {
|
| readSingle(RootDirectory.DRIVE.substring(1), 'drive', fake);
|
| } else {
|
| groups.drive = fake;
|
| + done();
|
| }
|
| // TODO(haruki): Add DirectoryModel.fakeDriveOfflineEntry_ to show the tab.
|
| } else {
|
| groups.drive = [];
|
| + done();
|
| }
|
| };
|
|
|
| @@ -1115,35 +1048,10 @@ DirectoryModel.prototype.updateRoots_ = function() {
|
| var dm = self.rootsList_;
|
| var args = [0, dm.length].concat(rootEntries);
|
| dm.splice.apply(dm, args);
|
| -
|
| - self.updateRootsListSelection_();
|
| });
|
| };
|
|
|
| /**
|
| - * Find roots list item by root path.
|
| - *
|
| - * @param {string} path Root path.
|
| - * @return {number} Index of the item.
|
| - */
|
| -DirectoryModel.prototype.findRootsListIndex = function(path) {
|
| - var roots = this.rootsList_;
|
| - for (var index = 0; index < roots.length; index++) {
|
| - if (roots.item(index).fullPath == path)
|
| - return index;
|
| - }
|
| - return -1;
|
| -};
|
| -
|
| -/**
|
| - * @private
|
| - */
|
| -DirectoryModel.prototype.updateRootsListSelection_ = function() {
|
| - var rootPath = this.getCurrentRootPath();
|
| - this.rootsListSelection_.selectedIndex = this.findRootsListIndex(rootPath);
|
| -};
|
| -
|
| -/**
|
| * @return {boolean} True if DRIVE is fully mounted.
|
| */
|
| DirectoryModel.prototype.isDriveMounted = function() {
|
| @@ -1314,7 +1222,7 @@ DirectoryModel.prototype.search = function(query,
|
| // |directoryEntry|.
|
| newDirContents = new DirectoryContentsDriveSearch(
|
| this.currentFileListContext_,
|
| - this.getSelectedRootDirEntry_(),
|
| + this.getCurrentDirEntry(),
|
| this.currentDirContents_.getLastNonSearchDirectoryEntry(),
|
| query);
|
| } else {
|
|
|