Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 FilePathWatcher::~FilePathWatcher() { | 43 FilePathWatcher::~FilePathWatcher() { |
| 44 impl_->Cancel(); | 44 impl_->Cancel(); |
| 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, |
|
Mattias Nissler (ping if slow)
2012/11/22 08:51:34
nit: no need to break the line.
kmadhusu
2012/12/03 20:11:36
Done.
| |
| 54 Delegate* delegate) { | |
| 54 DCHECK(path.IsAbsolute()); | 55 DCHECK(path.IsAbsolute()); |
| 55 return impl_->Watch(path, delegate); | 56 return impl_->Watch(path, false, delegate); |
| 56 } | 57 } |
| 57 | 58 |
| 58 FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) { | 59 FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) { |
| 59 } | 60 } |
| 60 | 61 |
| 61 FilePathWatcher::PlatformDelegate::~PlatformDelegate() { | 62 FilePathWatcher::PlatformDelegate::~PlatformDelegate() { |
| 62 DCHECK(is_cancelled()); | 63 DCHECK(is_cancelled()); |
| 63 } | 64 } |
| 64 | 65 |
| 65 bool FilePathWatcher::Watch(const FilePath& path, const Callback& callback) { | 66 bool FilePathWatcher::Watch(const FilePath& path, |
| 66 return Watch(path, new FilePathWatcherDelegate(callback)); | 67 bool recursive, |
| 68 const Callback& callback) { | |
| 69 DCHECK(path.IsAbsolute()); | |
| 70 return impl_->Watch(path, recursive, new FilePathWatcherDelegate(callback)); | |
| 67 } | 71 } |
| 68 | 72 |
| 69 } // namespace files | 73 } // namespace files |
| 70 } // namespace base | 74 } // namespace base |
| OLD | NEW |