| 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; | 15 class FilePathWatcher; |
| 16 } | 16 } |
| 17 | 17 |
| 18 class DevToolsFileWatcher { | 18 class DevToolsFileWatcher { |
| 19 public: | 19 public: |
| 20 using WatchCallback = base::Callback<void(const std::vector<std::string>&)>; | 20 using WatchCallback = base::Callback<void(const std::vector<std::string>&, |
| 21 const std::vector<std::string>&, |
| 22 const std::vector<std::string>&)>; |
| 21 explicit DevToolsFileWatcher(const WatchCallback& callback); | 23 explicit DevToolsFileWatcher(const WatchCallback& callback); |
| 22 ~DevToolsFileWatcher(); | 24 ~DevToolsFileWatcher(); |
| 23 | 25 |
| 24 void AddWatch(const base::FilePath& path); | 26 void AddWatch(const base::FilePath& path); |
| 25 void RemoveWatch(const base::FilePath& path); | 27 void RemoveWatch(const base::FilePath& path); |
| 26 | 28 |
| 27 private: | 29 private: |
| 28 class SharedFileWatcher; | 30 class SharedFileWatcher; |
| 29 static SharedFileWatcher* s_shared_watcher_; | 31 static SharedFileWatcher* s_shared_watcher_; |
| 30 | 32 |
| 31 void InitSharedWatcher(); | 33 void InitSharedWatcher(); |
| 32 void FileChanged(const base::FilePath&, int); | 34 void FileChanged(const base::FilePath&, int); |
| 33 | 35 |
| 34 scoped_refptr<SharedFileWatcher> shared_watcher_; | 36 scoped_refptr<SharedFileWatcher> shared_watcher_; |
| 35 WatchCallback callback_; | 37 WatchCallback callback_; |
| 36 DISALLOW_COPY_AND_ASSIGN(DevToolsFileWatcher); | 38 DISALLOW_COPY_AND_ASSIGN(DevToolsFileWatcher); |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_WATCHER_H_ | 41 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_WATCHER_H_ |
| OLD | NEW |