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 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 DISALLOW_COPY_AND_ASSIGN(EntryMetadata); | 50 DISALLOW_COPY_AND_ASSIGN(EntryMetadata); |
51 }; | 51 }; |
52 | 52 |
53 // Interface for a provided file system. Acts as a proxy between providers | 53 // Interface for a provided file system. Acts as a proxy between providers |
54 // and clients. All of the request methods return an abort callback in order to | 54 // and clients. All of the request methods return an abort callback in order to |
55 // terminate it while running. They must be called on the same thread as the | 55 // terminate it while running. They must be called on the same thread as the |
56 // request methods. The cancellation callback may be null if the operation | 56 // request methods. The cancellation callback may be null if the operation |
57 // fails synchronously. | 57 // fails synchronously. |
58 class ProvidedFileSystemInterface { | 58 class ProvidedFileSystemInterface { |
59 public: | 59 public: |
60 struct ChildChange; | 60 struct Change; |
61 | 61 |
62 // Mode of opening a file. Used by OpenFile(). | 62 // Mode of opening a file. Used by OpenFile(). |
63 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE }; | 63 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE }; |
64 | 64 |
65 // Extra fields to be fetched with metadata. | 65 // Extra fields to be fetched with metadata. |
66 enum MetadataField { | 66 enum MetadataField { |
67 METADATA_FIELD_DEFAULT = 0, | 67 METADATA_FIELD_DEFAULT = 0, |
68 METADATA_FIELD_THUMBNAIL = 1 << 0 | 68 METADATA_FIELD_THUMBNAIL = 1 << 0 |
69 }; | 69 }; |
70 | 70 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // Requests observing a directory. | 178 // Requests observing a directory. |
179 virtual AbortCallback ObserveDirectory( | 179 virtual AbortCallback ObserveDirectory( |
180 const base::FilePath& directory_path, | 180 const base::FilePath& directory_path, |
181 bool recursive, | 181 bool recursive, |
182 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 182 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
183 | 183 |
184 // Requests unobserving an entry, which is immediately removed from the | 184 // Requests unobserving an entry, which is immediately removed from the |
185 // internal list, hence the operation is not abortable. | 185 // internal list, hence the operation is not abortable. |
186 virtual void UnobserveEntry( | 186 virtual void UnobserveEntry( |
187 const base::FilePath& entry_path, | 187 const base::FilePath& entry_path, |
| 188 bool recursive, |
188 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 189 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
189 | 190 |
190 // Notifies about changes to the observed entries within the file system. | 191 // Notifies about changes to the observed entries within the file system. |
191 // Invoked by the file system implementation. Returns false if the | 192 // Invoked by the file system implementation. Returns false if the |
192 // notification arguments are malformed or the entry is not observed anymore. | 193 // notification arguments are malformed or the entry is not observed anymore. |
193 virtual bool Notify( | 194 virtual bool Notify(const base::FilePath& observed_path, |
194 const base::FilePath& observed_path, | 195 bool recursive, |
195 ProvidedFileSystemObserver::ChangeType change_type, | 196 ProvidedFileSystemObserver::ChangeType change_type, |
196 scoped_ptr<ProvidedFileSystemObserver::ChildChanges> child_changes, | 197 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, |
197 const std::string& tag) = 0; | 198 const std::string& tag) = 0; |
198 | 199 |
199 // Returns a provided file system info for this file system. | 200 // Returns a provided file system info for this file system. |
200 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const = 0; | 201 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const = 0; |
201 | 202 |
202 // Returns a mutable list of observed entries. | 203 // Returns a mutable list of observed entries. |
203 virtual ObservedEntries* GetObservedEntries() = 0; | 204 virtual ObservedEntries* GetObservedEntries() = 0; |
204 | 205 |
205 // Returns a request manager for the file system. | 206 // Returns a request manager for the file system. |
206 virtual RequestManager* GetRequestManager() = 0; | 207 virtual RequestManager* GetRequestManager() = 0; |
207 | 208 |
208 // Adds an observer on the file system. | 209 // Adds an observer on the file system. |
209 virtual void AddObserver(ProvidedFileSystemObserver* observer) = 0; | 210 virtual void AddObserver(ProvidedFileSystemObserver* observer) = 0; |
210 | 211 |
211 // Removes an observer. | 212 // Removes an observer. |
212 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; | 213 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; |
213 | 214 |
214 // Returns a weak pointer to this object. | 215 // Returns a weak pointer to this object. |
215 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; | 216 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; |
216 }; | 217 }; |
217 | 218 |
218 } // namespace file_system_provider | 219 } // namespace file_system_provider |
219 } // namespace chromeos | 220 } // namespace chromeos |
220 | 221 |
221 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT
ERFACE_H_ | 222 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT
ERFACE_H_ |
OLD | NEW |