OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_FILE_PATH_WATCHER_UTIL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_FILE_PATH_WATCHER_UTIL_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_FILE_PATH_WATCHER_UTIL_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_FILE_PATH_WATCHER_UTIL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/files/file_path_watcher.h" | 12 #include "base/files/file_path_watcher.h" |
13 | 13 |
14 typedef base::Callback<void(std::unique_ptr<base::FilePathWatcher> watcher)> | 14 typedef base::Callback<void(std::unique_ptr<base::FilePathWatcher> watcher)> |
15 FileWatchStartedCallback; | 15 FileWatchStartedCallback; |
16 | 16 |
17 // Called on the MediaTaskRunner to begin a file watch. | 17 // Called on the MediaTaskRunner to begin a file watch. |
18 // |watch_started_callback| is responsible for taking ownership of the | 18 // |watch_started_callback| is responsible for taking ownership of the |
19 // file watcher upon start. All callbacks are run on the MediaTaskRunner. | 19 // file watcher upon start. All callbacks are run on the MediaTaskRunner. |
20 void StartFilePathWatchOnMediaTaskRunner( | 20 void StartFilePathWatchOnMediaTaskRunner( |
21 const base::FilePath& path, | 21 const base::FilePath& path, |
22 const FileWatchStartedCallback& watch_started_callback, | 22 const FileWatchStartedCallback& watch_started_callback, |
23 const base::FilePathWatcher::Callback& path_changed_callback); | 23 const base::FilePathWatcher::Callback& path_changed_callback); |
24 | 24 |
25 // Stops a file path watch started by StartFilePathWatchOnMediaTaskRunner(). | |
26 // Must be called from the MediaTaskRunner. | |
27 void StopFilePathWatchOnMediaTaskRunner( | |
28 std::unique_ptr<base::FilePathWatcher> watcher); | |
29 | |
30 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_FILE_PATH_WATCHER_UTIL_H_ | 25 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_FILE_PATH_WATCHER_UTIL_H_ |
OLD | NEW |