(1) Added a recursive boolean param to FilePathWatcher::Watch() function to watch for sub directory tree changes. Fixed all the calling sites.
(2) Added support to watch sub trees on Windows.
(3) Added FilePathWatcherTest.RecursiveWatch browser test.
BUG=144491
TEST=none
Review URL: https://chromiumcodereview.appspot.com/11415066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171097 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 66a5940fbfc857691cef0cac9e201f6b3414007d
diff --git a/base/files/file_path_watcher.cc b/base/files/file_path_watcher.cc
index dd2b37f..bc8db37 100644
--- a/base/files/file_path_watcher.cc
+++ b/base/files/file_path_watcher.cc
@@ -52,7 +52,7 @@
bool FilePathWatcher::Watch(const FilePath& path, Delegate* delegate) {
DCHECK(path.IsAbsolute());
- return impl_->Watch(path, delegate);
+ return impl_->Watch(path, false, delegate);
}
FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) {
@@ -62,8 +62,11 @@
DCHECK(is_cancelled());
}
-bool FilePathWatcher::Watch(const FilePath& path, const Callback& callback) {
- return Watch(path, new FilePathWatcherDelegate(callback));
+bool FilePathWatcher::Watch(const FilePath& path,
+ bool recursive,
+ const Callback& callback) {
+ DCHECK(path.IsAbsolute());
+ return impl_->Watch(path, recursive, new FilePathWatcherDelegate(callback));
}
} // namespace files