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

Unified Diff: ui/file_manager/file_manager/foreground/js/file_watcher.js

Issue 639273002: Fixed a bug that the list still shows deleted directory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed to handle volumeInfo null case. Created 6 years, 2 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
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/directory_model.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/file_watcher.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_watcher.js b/ui/file_manager/file_manager/foreground/js/file_watcher.js
index d55af870451958df1160b7322d8229d37271c737..9db0971aeeb2d7783b63595387d00912deb5e84e 100644
--- a/ui/file_manager/file_manager/foreground/js/file_watcher.js
+++ b/ui/file_manager/file_manager/foreground/js/file_watcher.js
@@ -47,11 +47,30 @@ FileWatcher.prototype.dispose = function() {
* @private
*/
FileWatcher.prototype.onDirectoryChanged_ = function(event) {
- if (this.watchedDirectoryEntry_ &&
- event.entry.toURL() === this.watchedDirectoryEntry_.toURL()) {
+ var fireWatcherDirectoryChanged = function(changedFiles) {
var e = new Event('watcher-directory-changed');
- e.changedFiles = event.changedFiles;
+
+ if (changedFiles)
+ e.changedFiles = changedFiles;
+
this.dispatchEvent(e);
+ }.bind(this);
+
+ if (this.watchedDirectoryEntry_) {
+ var eventURL = event.entry.toURL();
+ var watchedDirURL = this.watchedDirectoryEntry_.toURL();
+
+ if (eventURL === watchedDirURL) {
+ fireWatcherDirectoryChanged(event.changedFiles);
+ } else if (watchedDirURL.match(new RegExp('^' + eventURL))) {
+ // When watched directory is deleted by the change in parent directory,
+ // notify it as watcher directory changed.
+ this.watchedDirectoryEntry_.getDirectory(
+ this.watchedDirectoryEntry_.fullPath,
+ {create: false},
+ null,
+ function() { fireWatcherDirectoryChanged(null); });
+ }
}
};
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/directory_model.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698