Chromium Code Reviews| 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 6a274d0301f2fb2088f25b8d7704e8d16076f2f2..93447823a019d1c5315a1822ebc6d1c6c0c099ac 100644 |
| --- a/chrome/browser/resources/file_manager/js/file_manager.js |
| +++ b/chrome/browser/resources/file_manager/js/file_manager.js |
| @@ -480,7 +480,7 @@ FileManager.prototype = { |
| (this.dialogType_ == FileManager.DialogType.FULL_PAGE || |
| this.dialogType_ == FileManager.DialogType.SELECT_OPEN_MULTI_FILE); |
| - this.table_.list.startBatchUpdates(); |
| + this.table_.startBatchUpdates(); |
| this.grid_.startBatchUpdates(); |
| this.initFileList_(); |
| @@ -520,8 +520,6 @@ FileManager.prototype = { |
| chrome.fileBrowserPrivate.onFileChanged.addListener( |
| this.onFileChanged_.bind(this)); |
| - var self = this; |
| - |
| // The list of callbacks to be invoked during the directory rescan after |
| // all paste tasks are complete. |
| this.pasteSuccessCallbacks_ = []; |
| @@ -546,7 +544,7 @@ FileManager.prototype = { |
| this.createMetadataProvider_(); |
| - this.table_.list.endBatchUpdates(); |
| + this.table_.endBatchUpdates(); |
| this.grid_.endBatchUpdates(); |
| metrics.recordInterval('Load.DOM'); |
| @@ -755,7 +753,9 @@ FileManager.prototype = { |
| // TODO(dgozman): add "Add a drive" item. |
| this.rootsList_.dataModel = this.directoryModel_.rootsList; |
| - this.directoryModel_.updateRoots(); |
| + this.directoryModel_.updateRoots(function() { |
| + self.rootsList_.endBatchUpdates(); |
|
rginda
2012/02/28 18:38:35
updateRoots may benefit from a try/catch so that t
Rick Byers
2012/02/28 19:56:26
It doesn't look to me like there's much logic that
|
| + }); |
| }; |
| /** |
| @@ -1384,10 +1384,17 @@ FileManager.prototype = { |
| * window has neither. |
| */ |
| FileManager.prototype.setupCurrentDirectory_ = function() { |
| + // Avoid a bunch of intermedia list redraws while the data model is cleared |
|
rginda
2012/02/28 18:38:35
typo: intermediate
Rick Byers
2012/02/28 19:56:26
Done.
|
| + // and updated. |
| + this.table_.startBatchUpdates(); |
| + var onLoaded = function() { |
| + this.table_.endBatchUpdates(); |
| + }.bind(this); |
| + |
| if (location.hash) { |
| // Location hash has the highest priority. |
| var path = decodeURI(location.hash.substr(1)); |
| - this.directoryModel_.setupPath(path); |
| + this.directoryModel_.setupPath(path, onLoaded); |
| return; |
| } else if (this.params_.defaultPath) { |
| var pathResolvedCallback; |
| @@ -1398,9 +1405,10 @@ FileManager.prototype = { |
| }.bind(this); |
| } |
| this.directoryModel_.setupPath(this.params_.defaultPath, |
| + onLoaded, |
| pathResolvedCallback); |
| } else { |
| - this.directoryModel_.setupDefaultPath(); |
| + this.directoryModel_.setupDefaultPath(onLoaded); |
| } |
| }; |
| @@ -2279,7 +2287,7 @@ FileManager.prototype = { |
| chrome.fileBrowserPrivate.getMountPoints(function(mountPoints) { |
| self.mountPoints_ = mountPoints; |
| self.updateVolumeMetadata_(); |
| - var changeDirectoryTo = null; |
| + var changeDirectoryCallback = null; |
| if (event.eventType == 'mount') { |
| // Mount request finished - remove it. |
| @@ -2323,13 +2331,16 @@ FileManager.prototype = { |
| return; |
| } |
| // Current durectory just unmounted. Move to the 'Downloads'. |
| - changeDirectoryTo = '/' + DirectoryModel.DOWNLOADS_DIRECTORY; |
| + changeDirectoryCallback = function() { |
| + self.directoryModel_.changeDirectory( |
| + '/' + DirectoryModel.DOWNLOADS_DIRECTORY); |
| + }; |
| } |
| // 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(changeDirectoryTo); |
| + self.directoryModel_.updateRoots(changeDirectoryCallback); |
| }); |
| }; |