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