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 14 matching lines...) Expand all Loading... |
25 const scoped_refptr<PlatformDelegate>& delegate) { | 25 const scoped_refptr<PlatformDelegate>& delegate) { |
26 delegate->CancelOnMessageLoopThread(); | 26 delegate->CancelOnMessageLoopThread(); |
27 } | 27 } |
28 | 28 |
29 // static | 29 // static |
30 bool FilePathWatcher::RecursiveWatchAvailable() { | 30 bool FilePathWatcher::RecursiveWatchAvailable() { |
31 #if defined(OS_MACOSX) && !defined(OS_IOS) | 31 #if defined(OS_MACOSX) && !defined(OS_IOS) |
32 // FSEvents isn't available on iOS and is broken on OSX 10.6 and earlier. | 32 // FSEvents isn't available on iOS and is broken on OSX 10.6 and earlier. |
33 // See http://crbug.com/54822#c31 | 33 // See http://crbug.com/54822#c31 |
34 return mac::IsOSLionOrLater(); | 34 return mac::IsOSLionOrLater(); |
35 #elif defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID) | 35 #elif defined(OS_LINUX) || defined(OS_ANDROID) |
36 return true; | 36 return true; |
37 #else | 37 #else |
38 return false; | 38 return false; |
39 #endif | 39 #endif |
40 } | 40 } |
41 | 41 |
42 FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) { | 42 FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) { |
43 } | 43 } |
44 | 44 |
45 FilePathWatcher::PlatformDelegate::~PlatformDelegate() { | 45 FilePathWatcher::PlatformDelegate::~PlatformDelegate() { |
46 DCHECK(is_cancelled()); | 46 DCHECK(is_cancelled()); |
47 } | 47 } |
48 | 48 |
49 bool FilePathWatcher::Watch(const FilePath& path, | 49 bool FilePathWatcher::Watch(const FilePath& path, |
50 bool recursive, | 50 bool recursive, |
51 const Callback& callback) { | 51 const Callback& callback) { |
52 DCHECK(path.IsAbsolute()); | 52 DCHECK(path.IsAbsolute()); |
53 return impl_->Watch(path, recursive, callback); | 53 return impl_->Watch(path, recursive, callback); |
54 } | 54 } |
55 | 55 |
56 } // namespace base | 56 } // namespace base |
OLD | NEW |