Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4372)

Unified Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 7466046: Some filebrowser bugs and retiring DiskChanged event in filebrowser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Two code formatting issues Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698