Index: chrome/browser/resources/file_manager/js/file_manager.js |
=================================================================== |
--- chrome/browser/resources/file_manager/js/file_manager.js (revision 96398) |
+++ chrome/browser/resources/file_manager/js/file_manager.js (working copy) |
@@ -139,9 +139,6 @@ |
this.summarizeSelection_(); |
this.updatePreview_(); |
- chrome.fileBrowserPrivate.onDiskChanged.addListener( |
- this.onDiskChanged_.bind(this)); |
- |
this.refocus(); |
// Pass all URLs to the metadata reader until we have a correct filter. |
@@ -1685,9 +1682,18 @@ |
} |
} |
} |
+ |
+ if (event.eventType == 'unmount' && event.status == 'success' && |
+ self.currentDirEntry_ && |
+ isParentPath(event.mountPath, self.currentDirEntry_.fullPath)) { |
+ self.changeDirectory(getParentPath(event.mountPath)); |
+ return; |
+ } |
+ |
// TODO(dgozman): rescan directory, only if it contains mounted points, |
// when mounts location will be decided. |
- this.rescanDirectory_(); |
+ if (event.status == 'success') |
+ self.rescanDirectory_(); |
}); |
}; |
@@ -2441,23 +2447,6 @@ |
}; |
/** |
- * Update the UI when a disk is mounted or unmounted. |
- * |
- * @param {string} path The path that has been mounted or unmounted. |
- */ |
- FileManager.prototype.onDiskChanged_ = function(event) { |
- if (event.eventType == 'added') { |
- this.changeDirectory(event.volumeInfo.mountPath); |
- } else if (event.eventType == 'removed') { |
- if (this.currentDirEntry_ && |
- isParentPath(event.volumeInfo.mountPath, |
- this.currentDirEntry_.fullPath)) { |
- this.changeDirectory(getParentPath(event.volumeInfo.mountPath)); |
- } |
- } |
- }; |
- |
- /** |
* Rescan the current directory, refreshing the list. |
* |
* @param {function()} opt_callback Optional function to invoke when the |