| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 file or directory for changes. | 5 // This module provides a way to monitor a file or directory for changes. |
| 6 | 6 |
| 7 #ifndef BASE_FILES_FILE_PATH_WATCHER_H_ | 7 #ifndef BASE_FILES_FILE_PATH_WATCHER_H_ |
| 8 #define BASE_FILES_FILE_PATH_WATCHER_H_ | 8 #define BASE_FILES_FILE_PATH_WATCHER_H_ |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // A callback that always cleans up the PlatformDelegate, either when executed | 86 // A callback that always cleans up the PlatformDelegate, either when executed |
| 87 // or when deleted without having been executed at all, as can happen during | 87 // or when deleted without having been executed at all, as can happen during |
| 88 // shutdown. | 88 // shutdown. |
| 89 static void CancelWatch(const scoped_refptr<PlatformDelegate>& delegate); | 89 static void CancelWatch(const scoped_refptr<PlatformDelegate>& delegate); |
| 90 | 90 |
| 91 // Invokes |callback| whenever updates to |path| are detected. This should be | 91 // Invokes |callback| whenever updates to |path| are detected. This should be |
| 92 // called at most once, and from a MessageLoop of TYPE_IO. Set |recursive| to | 92 // called at most once, and from a MessageLoop of TYPE_IO. Set |recursive| to |
| 93 // true, to watch |path| and its children. The callback will be invoked on | 93 // true, to watch |path| and its children. The callback will be invoked on |
| 94 // the same loop. Returns true on success. | 94 // the same loop. Returns true on success. |
| 95 // | 95 // |
| 96 // Recursive watch is not supported on all platforms and file systems. | 96 // NOTE: Recursive watch is not supported on all platforms and file systems. |
| 97 // Watch() will return false in the case of failure. | 97 // Watch() will return false in the case of failure. |
| 98 bool Watch(const FilePath& path, bool recursive, const Callback& callback); | 98 bool Watch(const FilePath& path, bool recursive, const Callback& callback); |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 scoped_refptr<PlatformDelegate> impl_; | 101 scoped_refptr<PlatformDelegate> impl_; |
| 102 | 102 |
| 103 DISALLOW_COPY_AND_ASSIGN(FilePathWatcher); | 103 DISALLOW_COPY_AND_ASSIGN(FilePathWatcher); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace base | 106 } // namespace base |
| 107 | 107 |
| 108 #endif // BASE_FILES_FILE_PATH_WATCHER_H_ | 108 #endif // BASE_FILES_FILE_PATH_WATCHER_H_ |
| OLD | NEW |