diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-18 20:38:09 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-18 20:38:09 +0000 |
commit | 33f8e3dfcc9c04c4aaa19757d8994161b650e040 (patch) | |
tree | 7a6065bacc7197182f1b22c6f37de6c1838aa08f /base/directory_watcher.h | |
parent | 3083a622a26104514d1db147194cc8d9fa7c8752 (diff) | |
download | chromium_src-33f8e3dfcc9c04c4aaa19757d8994161b650e040.zip chromium_src-33f8e3dfcc9c04c4aaa19757d8994161b650e040.tar.gz chromium_src-33f8e3dfcc9c04c4aaa19757d8994161b650e040.tar.bz2 |
Cleanup in DirectoryWatcher:
- share more code between different platforms
- put more code inside anonymous namespace
- add more DISALLOW_COPY_AND_ASSIGNs
- small #include cleanup
Review URL: http://codereview.chromium.org/42343
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12007 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/directory_watcher.h')
-rw-r--r-- | base/directory_watcher.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/base/directory_watcher.h b/base/directory_watcher.h index d6fc534..12040a6 100644 --- a/base/directory_watcher.h +++ b/base/directory_watcher.h @@ -7,7 +7,6 @@ #ifndef BASE_DIRECTORY_WATCHER_H_ #define BASE_DIRECTORY_WATCHER_H_ -#include <string> #include "base/basictypes.h" #include "base/ref_counted.h" @@ -24,18 +23,26 @@ class DirectoryWatcher { }; DirectoryWatcher(); - ~DirectoryWatcher(); + ~DirectoryWatcher() {} // Register interest in any changes in the directory |path|. // OnDirectoryChanged will be called back for each change within the dir. // If |recursive| is true, the delegate will be notified for each change // within the directory tree starting at |path|. Returns false on error. - bool Watch(const FilePath& path, Delegate* delegate, bool recursive); + bool Watch(const FilePath& path, Delegate* delegate, bool recursive) { + return impl_->Watch(path, delegate, recursive); + } + + // Used internally to encapsulate different members on different platforms. + class PlatformDelegate : public base::RefCounted<PlatformDelegate> { + public: + virtual ~PlatformDelegate() {} + virtual bool Watch(const FilePath& path, Delegate* delegate, + bool recursive) = 0; + }; private: - class Impl; - friend class Impl; - scoped_refptr<Impl> impl_; + scoped_refptr<PlatformDelegate> impl_; DISALLOW_COPY_AND_ASSIGN(DirectoryWatcher); }; |