Index: chrome/browser/resources/file_manager/js/file_manager.js |
=================================================================== |
--- chrome/browser/resources/file_manager/js/file_manager.js (revision 124785) |
+++ chrome/browser/resources/file_manager/js/file_manager.js (working copy) |
@@ -477,7 +477,7 @@ |
(this.dialogType_ == FileManager.DialogType.FULL_PAGE || |
this.dialogType_ == FileManager.DialogType.SELECT_OPEN_MULTI_FILE); |
- this.table_.startBatchUpdates(); |
+ this.table_.list.startBatchUpdates(); |
this.grid_.startBatchUpdates(); |
this.initFileList_(); |
@@ -545,7 +545,7 @@ |
this.createMetadataProvider_(); |
- this.table_.endBatchUpdates(); |
+ this.table_.list.endBatchUpdates(); |
this.grid_.endBatchUpdates(); |
metrics.recordInterval('Load.DOM'); |
@@ -756,9 +756,7 @@ |
// TODO(dgozman): add "Add a drive" item. |
this.rootsList_.dataModel = this.directoryModel_.rootsList; |
- this.directoryModel_.updateRoots(function() { |
- self.rootsList_.endBatchUpdates(); |
- }); |
+ this.directoryModel_.updateRoots(); |
}; |
FileManager.prototype.initGData_ = function() { |
@@ -1397,14 +1395,6 @@ |
* window has neither. |
*/ |
FileManager.prototype.setupCurrentDirectory_ = function() { |
- // Avoid a bunch of intermediate list redraws while the data model is |
- // cleared and updated. Note that it may (or may not) be desirable to draw |
- // partial results as we get them, but today the DirectoryReader API |
- // generally returns all entries in one chunk so even without this batching |
- // we wouldn't have incremental updates. |
- this.table_.startBatchUpdates(); |
- var onLoaded = this.table_.endBatchUpdates.bind(this.table_); |
- |
if (location.hash) { |
// Location hash has the highest priority. |
var path = decodeURI(location.hash.substr(1)); |
@@ -1420,15 +1410,10 @@ |
this.document_.body.appendChild(shade); |
function removeShade() { shade.parentNode.removeChild(shade) } |
- // Keep track of whether the path is identified as an existing leaf |
- // node. Note that onResolve is guaranteed to be called (exactly once) |
- // before onLoadedActivateLeaf. |
- var foundLeaf = true; |
function onResolve(baseName, leafName, exists) { |
if (!exists || leafName == '') { |
// Non-existent file or a directory. Remove the shade immediately. |
removeShade(); |
- foundLeaf = false; |
} |
} |
@@ -1436,38 +1421,33 @@ |
// of urls instead of a selection. This will remove the need to wait |
// until the selection is done. |
var self = this; |
- function onLoadedActivateLeaf() { |
- onLoaded(); |
- if (foundLeaf) { |
- self.dispatchDefaultTask_(); |
- setTimeout(removeShade, 1000); |
- } |
+ function onFileSelected() { |
+ self.dispatchDefaultTask_(); |
+ setTimeout(removeShade, 1000); |
} |
- this.directoryModel_.setupPath(path, onLoadedActivateLeaf, onResolve); |
- |
+ this.directoryModel_.setupPath(path, onResolve, onFileSelected); |
return; |
} |
- this.directoryModel_.setupPath(path, onLoaded); |
+ this.directoryModel_.setupPath(path); |
return; |
} |
if (this.params_.defaultPath) { |
var path = this.params_.defaultPath; |
if (this.dialogType_ == FileManager.DialogType.SELECT_SAVEAS_FILE) { |
- this.directoryModel_.setupPath(path, onLoaded, |
- function(basePath, leafName) { |
- this.filenameInput_.value = leafName; |
- this.selectDefaultPathInFilenameInput_(); |
- }.bind(this)); |
+ this.directoryModel_.setupPath(path, function(basePath, leafName) { |
+ this.filenameInput_.value = leafName; |
+ this.selectDefaultPathInFilenameInput_(); |
+ }.bind(this)); |
return; |
} |
- this.directoryModel_.setupPath(path, onLoaded); |
+ this.directoryModel_.setupPath(path); |
return; |
} |
- this.directoryModel_.setupDefaultPath(onLoaded); |
+ this.directoryModel_.setupDefaultPath(); |
}; |
/** |
@@ -2420,11 +2400,7 @@ |
// Even if something failed root list should be rescanned. |
// Failed mounts can "give" us new devices which might be formatted, |
// so we have to refresh root list then. |
- self.directoryModel_.updateRoots(function() { |
- if (changeDirectoryTo) { |
- self.directoryModel_.changeDirectory(changeDirectoryTo); |
- } |
- }); |
+ self.directoryModel_.updateRoots(changeDirectoryTo); |
}); |
}; |