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_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" | 17 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" |
18 #include "chrome/browser/chromeos/file_system_provider/watcher.h" | 18 #include "chrome/browser/chromeos/file_system_provider/watcher.h" |
19 #include "storage/browser/fileapi/async_file_util.h" | 19 #include "storage/browser/fileapi/async_file_util.h" |
| 20 #include "storage/browser/fileapi/watcher_manager.h" |
20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
21 | 22 |
22 class EventRouter; | 23 class EventRouter; |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 class Time; | 26 class Time; |
26 } // namespace base | 27 } // namespace base |
27 | 28 |
28 namespace net { | 29 namespace net { |
29 class IOBuffer; | 30 class IOBuffer; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 171 |
171 // Requests writing to a file previously opened with |file_handle|. | 172 // Requests writing to a file previously opened with |file_handle|. |
172 virtual AbortCallback WriteFile( | 173 virtual AbortCallback WriteFile( |
173 int file_handle, | 174 int file_handle, |
174 net::IOBuffer* buffer, | 175 net::IOBuffer* buffer, |
175 int64 offset, | 176 int64 offset, |
176 int length, | 177 int length, |
177 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 178 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
178 | 179 |
179 // Requests adding a watcher on an entry. |recursive| must not be true for | 180 // Requests adding a watcher on an entry. |recursive| must not be true for |
180 // files. | 181 // files. |callback| is optional, but it can't be used for persistent |
| 182 // watchers. |
181 virtual AbortCallback AddWatcher( | 183 virtual AbortCallback AddWatcher( |
182 const GURL& origin, | 184 const GURL& origin, |
183 const base::FilePath& entry_path, | 185 const base::FilePath& entry_path, |
184 bool recursive, | 186 bool recursive, |
185 bool persistent, | 187 bool persistent, |
186 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 188 const storage::AsyncFileUtil::StatusCallback& callback, |
| 189 const storage::WatcherManager::NotificationCallback& |
| 190 notification_callback) = 0; |
187 | 191 |
188 // Requests removing a watcher, which is immediately deleted from the internal | 192 // Requests removing a watcher, which is immediately deleted from the internal |
189 // list, hence the operation is not abortable. | 193 // list, hence the operation is not abortable. |
190 virtual void RemoveWatcher( | 194 virtual void RemoveWatcher( |
191 const GURL& origin, | 195 const GURL& origin, |
192 const base::FilePath& entry_path, | 196 const base::FilePath& entry_path, |
193 bool recursive, | 197 bool recursive, |
194 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 198 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
195 | 199 |
196 // Notifies about changes related to the watcher within the file system. | 200 // Notifies about changes related to the watcher within the file system. |
197 // Invoked by the file system implementation. Returns false if the | 201 // Invoked by the file system implementation. Returns false if the |
198 // notification arguments are malformed or the entry is not watched anymore. | 202 // notification arguments are malformed or the entry is not watched anymore. |
199 // TODO(mtomasz): Replace [entry_path, recursive] with a watcher id. | 203 // TODO(mtomasz): Replace [entry_path, recursive] with a watcher id. |
200 virtual bool Notify(const base::FilePath& entry_path, | 204 virtual bool Notify(const base::FilePath& entry_path, |
201 bool recursive, | 205 bool recursive, |
202 ProvidedFileSystemObserver::ChangeType change_type, | 206 storage::WatcherManager::ChangeType change_type, |
203 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, | 207 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, |
204 const std::string& tag) = 0; | 208 const std::string& tag) = 0; |
205 | 209 |
206 // Returns a provided file system info for this file system. | 210 // Returns a provided file system info for this file system. |
207 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const = 0; | 211 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const = 0; |
208 | 212 |
209 // Returns a mutable list of watchers. | 213 // Returns a mutable list of watchers. |
210 virtual Watchers* GetWatchers() = 0; | 214 virtual Watchers* GetWatchers() = 0; |
211 | 215 |
212 // Returns a request manager for the file system. | 216 // Returns a request manager for the file system. |
213 virtual RequestManager* GetRequestManager() = 0; | 217 virtual RequestManager* GetRequestManager() = 0; |
214 | 218 |
215 // Adds an observer on the file system. | 219 // Adds an observer on the file system. |
216 virtual void AddObserver(ProvidedFileSystemObserver* observer) = 0; | 220 virtual void AddObserver(ProvidedFileSystemObserver* observer) = 0; |
217 | 221 |
218 // Removes an observer. | 222 // Removes an observer. |
219 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; | 223 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; |
220 | 224 |
221 // Returns a weak pointer to this object. | 225 // Returns a weak pointer to this object. |
222 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; | 226 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; |
223 }; | 227 }; |
224 | 228 |
225 } // namespace file_system_provider | 229 } // namespace file_system_provider |
226 } // namespace chromeos | 230 } // namespace chromeos |
227 | 231 |
228 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT
ERFACE_H_ | 232 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT
ERFACE_H_ |
OLD | NEW |