(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
diff --git a/base/files/file_path_watcher.h b/base/files/file_path_watcher.h
index 367be943..94a3f9ad 100644
--- a/base/files/file_path_watcher.h
+++ b/base/files/file_path_watcher.h
@@ -59,6 +59,7 @@
 
     // Start watching for the given |path| and notify |delegate| about changes.
     virtual bool Watch(const FilePath& path,
+                       bool recursive,
                        Delegate* delegate) WARN_UNUSED_RESULT = 0;
 
     // Stop watching. This is called from FilePathWatcher's dtor in order to
@@ -119,9 +120,13 @@
       WARN_UNUSED_RESULT;
 
   // Invokes |callback| whenever updates to |path| are detected. This should be
-  // called at most once, and from a MessageLoop of TYPE_IO. The callback will
-  // be invoked on the same loop. Returns true on success.
-  bool Watch(const FilePath& path, const Callback& callback);
+  // called at most once, and from a MessageLoop of TYPE_IO. Set |recursive| to
+  // true, to watch |path| and its children. The callback will be invoked on
+  // the same loop. Returns true on success.
+  //
+  // NOTE: Recursive watch is not supported on all platforms and file systems.
+  // Watch() will return false in the case of failure.
+  bool Watch(const FilePath& path, bool recursive, const Callback& callback);
 
  private:
   scoped_refptr<PlatformDelegate> impl_;