OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Cross platform methods for FilePathWatcher. See the various platform | 5 // Cross platform methods for FilePathWatcher. See the various platform |
6 // specific implementation files, too. | 6 // specific implementation files, too. |
7 | 7 |
8 #include "base/files/file_path_watcher.h" | 8 #include "base/files/file_path_watcher.h" |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 // static | 47 // static |
48 void FilePathWatcher::CancelWatch( | 48 void FilePathWatcher::CancelWatch( |
49 const scoped_refptr<PlatformDelegate>& delegate) { | 49 const scoped_refptr<PlatformDelegate>& delegate) { |
50 delegate->CancelOnMessageLoopThread(); | 50 delegate->CancelOnMessageLoopThread(); |
51 } | 51 } |
52 | 52 |
53 bool FilePathWatcher::Watch(const FilePath& path, Delegate* delegate) { | 53 bool FilePathWatcher::Watch(const FilePath& path, Delegate* delegate) { |
54 DCHECK(path.IsAbsolute()); | 54 DCHECK(path.IsAbsolute()); |
55 return impl_->Watch(path, delegate); | 55 return impl_->Watch(path, false, delegate); |
56 } | 56 } |
57 | 57 |
58 FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) { | 58 FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) { |
59 } | 59 } |
60 | 60 |
61 FilePathWatcher::PlatformDelegate::~PlatformDelegate() { | 61 FilePathWatcher::PlatformDelegate::~PlatformDelegate() { |
62 DCHECK(is_cancelled()); | 62 DCHECK(is_cancelled()); |
63 } | 63 } |
64 | 64 |
65 bool FilePathWatcher::Watch(const FilePath& path, const Callback& callback) { | 65 bool FilePathWatcher::Watch(const FilePath& path, |
66 return Watch(path, new FilePathWatcherDelegate(callback)); | 66 bool recursive, |
| 67 const Callback& callback) { |
| 68 DCHECK(path.IsAbsolute()); |
| 69 return impl_->Watch(path, recursive, new FilePathWatcherDelegate(callback)); |
67 } | 70 } |
68 | 71 |
69 } // namespace files | 72 } // namespace files |
70 } // namespace base | 73 } // namespace base |
OLD | NEW |