OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This module provides a way to monitor a directory for changes. | 5 // This module provides a way to monitor a directory for changes. |
6 | 6 |
7 #ifndef BASE_DIRECTORY_WATCHER_H_ | 7 #ifndef BASE_DIRECTORY_WATCHER_H_ |
8 #define BASE_DIRECTORY_WATCHER_H_ | 8 #define BASE_DIRECTORY_WATCHER_H_ |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // is consistent on any particular version of Windows, but not across | 39 // is consistent on any particular version of Windows, but not across |
40 // different versions. | 40 // different versions. |
41 bool Watch(const FilePath& path, Delegate* delegate, | 41 bool Watch(const FilePath& path, Delegate* delegate, |
42 MessageLoop* backend_loop, bool recursive) { | 42 MessageLoop* backend_loop, bool recursive) { |
43 return impl_->Watch(path, delegate, backend_loop, recursive); | 43 return impl_->Watch(path, delegate, backend_loop, recursive); |
44 } | 44 } |
45 | 45 |
46 // Used internally to encapsulate different members on different platforms. | 46 // Used internally to encapsulate different members on different platforms. |
47 class PlatformDelegate : public base::RefCounted<PlatformDelegate> { | 47 class PlatformDelegate : public base::RefCounted<PlatformDelegate> { |
48 public: | 48 public: |
49 virtual ~PlatformDelegate() {} | |
50 virtual bool Watch(const FilePath& path, Delegate* delegate, | 49 virtual bool Watch(const FilePath& path, Delegate* delegate, |
51 MessageLoop* backend_loop, bool recursive) = 0; | 50 MessageLoop* backend_loop, bool recursive) = 0; |
| 51 |
| 52 protected: |
| 53 friend class base::RefCounted<PlatformDelegate>; |
| 54 |
| 55 virtual ~PlatformDelegate() {} |
52 }; | 56 }; |
53 | 57 |
54 private: | 58 private: |
55 scoped_refptr<PlatformDelegate> impl_; | 59 scoped_refptr<PlatformDelegate> impl_; |
56 | 60 |
57 DISALLOW_COPY_AND_ASSIGN(DirectoryWatcher); | 61 DISALLOW_COPY_AND_ASSIGN(DirectoryWatcher); |
58 }; | 62 }; |
59 | 63 |
60 #endif // BASE_DIRECTORY_WATCHER_H_ | 64 #endif // BASE_DIRECTORY_WATCHER_H_ |
OLD | NEW |