| 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); });
|
| + }
|
| }
|
| };
|
|
|
|
|