| 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 #include "base/files/file_path_watcher.h" | 5 #include "base/files/file_path_watcher.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // |last_modified_| time stamp. | 74 // |last_modified_| time stamp. |
| 75 base::Time first_notification_; | 75 base::Time first_notification_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(FilePathWatcherImpl); | 77 DISALLOW_COPY_AND_ASSIGN(FilePathWatcherImpl); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 bool FilePathWatcherImpl::Watch(const FilePath& path, | 80 bool FilePathWatcherImpl::Watch(const FilePath& path, |
| 81 FilePathWatcher::Delegate* delegate) { | 81 FilePathWatcher::Delegate* delegate) { |
| 82 DCHECK(target_.value().empty()); // Can only watch one path. | 82 DCHECK(target_.value().empty()); // Can only watch one path. |
| 83 | 83 |
| 84 set_message_loop(base::MessageLoopProxy::CreateForCurrentThread()); | 84 set_message_loop(base::MessageLoopProxy::current()); |
| 85 delegate_ = delegate; | 85 delegate_ = delegate; |
| 86 target_ = path; | 86 target_ = path; |
| 87 MessageLoop::current()->AddDestructionObserver(this); | 87 MessageLoop::current()->AddDestructionObserver(this); |
| 88 | 88 |
| 89 if (!UpdateWatch()) | 89 if (!UpdateWatch()) |
| 90 return false; | 90 return false; |
| 91 | 91 |
| 92 watcher_.StartWatching(handle_, this); | 92 watcher_.StartWatching(handle_, this); |
| 93 | 93 |
| 94 return true; | 94 return true; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace | 274 } // namespace |
| 275 | 275 |
| 276 FilePathWatcher::FilePathWatcher() { | 276 FilePathWatcher::FilePathWatcher() { |
| 277 impl_ = new FilePathWatcherImpl(); | 277 impl_ = new FilePathWatcherImpl(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace files | 280 } // namespace files |
| 281 } // namespace base | 281 } // namespace base |
| OLD | NEW |