| 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 #include "base/directory_watcher.h" | 5 #include "base/directory_watcher.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/object_watcher.h" | 9 #include "base/object_watcher.h" |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 if (handle_ != INVALID_HANDLE_VALUE) { | 40 if (handle_ != INVALID_HANDLE_VALUE) { |
| 41 watcher_.StopWatching(); | 41 watcher_.StopWatching(); |
| 42 FindCloseChangeNotification(handle_); | 42 FindCloseChangeNotification(handle_); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool DirectoryWatcherImpl::Watch(const FilePath& path, | 46 bool DirectoryWatcherImpl::Watch(const FilePath& path, |
| 47 DirectoryWatcher::Delegate* delegate, bool recursive) { | 47 DirectoryWatcher::Delegate* delegate, bool recursive) { |
| 48 DCHECK(path_.value().empty()); // Can only watch one path. | 48 DCHECK(path_.value().empty()); // Can only watch one path. |
| 49 | 49 |
| 50 if (!recursive) { | |
| 51 // See http://crbug.com/5072. | |
| 52 NOTIMPLEMENTED(); | |
| 53 return false; | |
| 54 } | |
| 55 | |
| 56 handle_ = FindFirstChangeNotification( | 50 handle_ = FindFirstChangeNotification( |
| 57 path.value().c_str(), | 51 path.value().c_str(), |
| 58 TRUE, // Watch subtree. | 52 recursive, |
| 59 FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE | | 53 FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE | |
| 60 FILE_NOTIFY_CHANGE_LAST_WRITE); | 54 FILE_NOTIFY_CHANGE_LAST_WRITE); |
| 61 if (handle_ == INVALID_HANDLE_VALUE) | 55 if (handle_ == INVALID_HANDLE_VALUE) |
| 62 return false; | 56 return false; |
| 63 | 57 |
| 64 delegate_ = delegate; | 58 delegate_ = delegate; |
| 65 path_ = path; | 59 path_ = path; |
| 66 watcher_.StartWatching(handle_, this); | 60 watcher_.StartWatching(handle_, this); |
| 67 | 61 |
| 68 return true; | 62 return true; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 79 BOOL ok = FindNextChangeNotification(object); | 73 BOOL ok = FindNextChangeNotification(object); |
| 80 DCHECK(ok); | 74 DCHECK(ok); |
| 81 watcher_.StartWatching(object, this); | 75 watcher_.StartWatching(object, this); |
| 82 } | 76 } |
| 83 | 77 |
| 84 } // namespace | 78 } // namespace |
| 85 | 79 |
| 86 DirectoryWatcher::DirectoryWatcher() { | 80 DirectoryWatcher::DirectoryWatcher() { |
| 87 impl_ = new DirectoryWatcherImpl(); | 81 impl_ = new DirectoryWatcherImpl(); |
| 88 } | 82 } |
| OLD | NEW |