OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSIONS_API_FILE_SYSTEM_ENTRY_WATCHER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_ENTRY_WATCHER_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_ENTRY_WATCHER_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_ENTRY_WATCHER_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 25 matching lines...) Expand all Loading... |
36 public: | 36 public: |
37 typedef base::Callback< | 37 typedef base::Callback< |
38 void(const std::string& extension_id, scoped_ptr<Event> event)> | 38 void(const std::string& extension_id, scoped_ptr<Event> event)> |
39 DispatchEventImplCallback; | 39 DispatchEventImplCallback; |
40 | 40 |
41 typedef base::Callback<storage::FileSystemContext*( | 41 typedef base::Callback<storage::FileSystemContext*( |
42 const std::string& extension_id, | 42 const std::string& extension_id, |
43 content::BrowserContext* context)> GetFileSystemContextImplCallback; | 43 content::BrowserContext* context)> GetFileSystemContextImplCallback; |
44 | 44 |
45 explicit EntryWatcherService(content::BrowserContext* context); | 45 explicit EntryWatcherService(content::BrowserContext* context); |
46 virtual ~EntryWatcherService(); | 46 ~EntryWatcherService() override; |
47 | 47 |
48 // Watches a directory. Only one watcher can be set per the same |url| and | 48 // Watches a directory. Only one watcher can be set per the same |url| and |
49 // |extension_id|. | 49 // |extension_id|. |
50 void WatchDirectory(const std::string& extension_id, | 50 void WatchDirectory(const std::string& extension_id, |
51 const storage::FileSystemURL& url, | 51 const storage::FileSystemURL& url, |
52 bool recursive, | 52 bool recursive, |
53 const storage::WatcherManager::StatusCallback& callback); | 53 const storage::WatcherManager::StatusCallback& callback); |
54 | 54 |
55 // Unwatches an entry (file or directory). | 55 // Unwatches an entry (file or directory). |
56 void UnwatchEntry(const std::string& extension_id, | 56 void UnwatchEntry(const std::string& extension_id, |
57 const storage::FileSystemURL& url, | 57 const storage::FileSystemURL& url, |
58 const storage::WatcherManager::StatusCallback& callback); | 58 const storage::WatcherManager::StatusCallback& callback); |
59 | 59 |
60 std::vector<storage::FileSystemURL> GetWatchedEntries( | 60 std::vector<storage::FileSystemURL> GetWatchedEntries( |
61 const std::string& extension_id); | 61 const std::string& extension_id); |
62 | 62 |
63 // storage::WatcherManager::Observer overrides. | 63 // storage::WatcherManager::Observer overrides. |
64 virtual void OnEntryChanged(const storage::FileSystemURL& url) override; | 64 void OnEntryChanged(const storage::FileSystemURL& url) override; |
65 virtual void OnEntryRemoved(const storage::FileSystemURL& url) override; | 65 void OnEntryRemoved(const storage::FileSystemURL& url) override; |
66 | 66 |
67 // Sets a custom dispatcher for tests in order to be able to verify dispatched | 67 // Sets a custom dispatcher for tests in order to be able to verify dispatched |
68 // events. | 68 // events. |
69 void SetDispatchEventImplForTesting( | 69 void SetDispatchEventImplForTesting( |
70 const DispatchEventImplCallback& callback); | 70 const DispatchEventImplCallback& callback); |
71 | 71 |
72 // Sets a custom context getter for tests in order to inject a testing | 72 // Sets a custom context getter for tests in order to inject a testing |
73 // file system context implementation. | 73 // file system context implementation. |
74 void SetGetFileSystemContextImplForTesting( | 74 void SetGetFileSystemContextImplForTesting( |
75 const GetFileSystemContextImplCallback& callback); | 75 const GetFileSystemContextImplCallback& callback); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 ScopedObserver<storage::WatcherManager, storage::WatcherManager::Observer> | 119 ScopedObserver<storage::WatcherManager, storage::WatcherManager::Observer> |
120 observing_; | 120 observing_; |
121 base::WeakPtrFactory<EntryWatcherService> weak_ptr_factory_; | 121 base::WeakPtrFactory<EntryWatcherService> weak_ptr_factory_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(EntryWatcherService); | 123 DISALLOW_COPY_AND_ASSIGN(EntryWatcherService); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace extensions | 126 } // namespace extensions |
127 | 127 |
128 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_ENTRY_WATCHER_SERVICE_H_ | 128 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_ENTRY_WATCHER_SERVICE_H_ |
OLD | NEW |