OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_DEVTOOLS_DEVTOOLS_FILE_WATCHER_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_WATCHER_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_WATCHER_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_WATCHER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class FilePath; | 14 class FilePath; |
15 class FilePathWatcher; | |
16 } | 15 } |
17 | 16 |
18 class DevToolsFileWatcher { | 17 class DevToolsFileWatcher { |
19 public: | 18 public: |
20 using WatchCallback = base::Callback<void(const std::vector<std::string>&, | 19 using WatchCallback = base::Callback<void(const std::vector<std::string>&, |
21 const std::vector<std::string>&, | 20 const std::vector<std::string>&, |
22 const std::vector<std::string>&)>; | 21 const std::vector<std::string>&)>; |
23 explicit DevToolsFileWatcher(const WatchCallback& callback); | 22 explicit DevToolsFileWatcher(const WatchCallback& callback); |
24 ~DevToolsFileWatcher(); | 23 ~DevToolsFileWatcher(); |
25 | 24 |
26 void AddWatch(const base::FilePath& path); | 25 void AddWatch(const base::FilePath& path); |
27 void RemoveWatch(const base::FilePath& path); | 26 void RemoveWatch(const base::FilePath& path); |
28 | 27 |
29 private: | 28 private: |
30 class SharedFileWatcher; | 29 class SharedFileWatcher; |
31 static SharedFileWatcher* s_shared_watcher_; | 30 static SharedFileWatcher* s_shared_watcher_; |
32 | 31 |
33 void InitSharedWatcher(); | 32 void InitSharedWatcher(); |
34 void FileChanged(const base::FilePath&, int); | 33 void FileChanged(const base::FilePath&, int); |
35 | 34 |
36 scoped_refptr<SharedFileWatcher> shared_watcher_; | 35 scoped_refptr<SharedFileWatcher> shared_watcher_; |
37 WatchCallback callback_; | 36 WatchCallback callback_; |
38 DISALLOW_COPY_AND_ASSIGN(DevToolsFileWatcher); | 37 DISALLOW_COPY_AND_ASSIGN(DevToolsFileWatcher); |
39 }; | 38 }; |
40 | 39 |
41 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_WATCHER_H_ | 40 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_WATCHER_H_ |
OLD | NEW |