| 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 <stdint.h> |
| 9 |
| 8 #include <map> | 10 #include <map> |
| 9 #include <string> | 11 #include <string> |
| 10 #include <vector> | 12 #include <vector> |
| 11 | 13 |
| 12 #include "base/callback.h" | 14 #include "base/callback.h" |
| 13 #include "base/files/file.h" | 15 #include "base/files/file.h" |
| 14 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 17 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 18 #include "chrome/browser/chromeos/file_system_provider/abort_callback.h" | 21 #include "chrome/browser/chromeos/file_system_provider/abort_callback.h" |
| 19 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" | 22 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" |
| 20 #include "chrome/browser/chromeos/file_system_provider/watcher.h" | 23 #include "chrome/browser/chromeos/file_system_provider/watcher.h" |
| 21 #include "storage/browser/fileapi/async_file_util.h" | 24 #include "storage/browser/fileapi/async_file_util.h" |
| 22 #include "storage/browser/fileapi/watcher_manager.h" | 25 #include "storage/browser/fileapi/watcher_manager.h" |
| 23 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 24 | 27 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 38 | 41 |
| 39 // Represents metadata for either a file or a directory. | 42 // Represents metadata for either a file or a directory. |
| 40 struct EntryMetadata { | 43 struct EntryMetadata { |
| 41 EntryMetadata(); | 44 EntryMetadata(); |
| 42 ~EntryMetadata(); | 45 ~EntryMetadata(); |
| 43 | 46 |
| 44 // All of the metadata fields are optional. All strings which are set, are | 47 // All of the metadata fields are optional. All strings which are set, are |
| 45 // non-empty. | 48 // non-empty. |
| 46 scoped_ptr<bool> is_directory; | 49 scoped_ptr<bool> is_directory; |
| 47 scoped_ptr<std::string> name; | 50 scoped_ptr<std::string> name; |
| 48 scoped_ptr<int64> size; | 51 scoped_ptr<int64_t> size; |
| 49 scoped_ptr<base::Time> modification_time; | 52 scoped_ptr<base::Time> modification_time; |
| 50 scoped_ptr<std::string> mime_type; | 53 scoped_ptr<std::string> mime_type; |
| 51 scoped_ptr<std::string> thumbnail; | 54 scoped_ptr<std::string> thumbnail; |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(EntryMetadata); | 57 DISALLOW_COPY_AND_ASSIGN(EntryMetadata); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 // Represents actions for either a file or a directory. | 60 // Represents actions for either a file or a directory. |
| 58 struct Action { | 61 struct Action { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 virtual AbortCallback CloseFile( | 161 virtual AbortCallback CloseFile( |
| 159 int file_handle, | 162 int file_handle, |
| 160 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 163 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
| 161 | 164 |
| 162 // Requests reading a file previously opened with |file_handle|. The callback | 165 // Requests reading a file previously opened with |file_handle|. The callback |
| 163 // can be called multiple times until |has_more| is set to false. On success | 166 // can be called multiple times until |has_more| is set to false. On success |
| 164 // it should return |length| bytes starting from |offset| in total. It can | 167 // it should return |length| bytes starting from |offset| in total. It can |
| 165 // return less only in case EOF is encountered. | 168 // return less only in case EOF is encountered. |
| 166 virtual AbortCallback ReadFile(int file_handle, | 169 virtual AbortCallback ReadFile(int file_handle, |
| 167 net::IOBuffer* buffer, | 170 net::IOBuffer* buffer, |
| 168 int64 offset, | 171 int64_t offset, |
| 169 int length, | 172 int length, |
| 170 const ReadChunkReceivedCallback& callback) = 0; | 173 const ReadChunkReceivedCallback& callback) = 0; |
| 171 | 174 |
| 172 // Requests creating a directory. If |recursive| is passed, then all non | 175 // Requests creating a directory. If |recursive| is passed, then all non |
| 173 // existing directories on the path will be created. The operation will fail | 176 // existing directories on the path will be created. The operation will fail |
| 174 // if the target directory already exists. | 177 // if the target directory already exists. |
| 175 virtual AbortCallback CreateDirectory( | 178 virtual AbortCallback CreateDirectory( |
| 176 const base::FilePath& directory_path, | 179 const base::FilePath& directory_path, |
| 177 bool recursive, | 180 bool recursive, |
| 178 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 181 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 200 // Requests moving an entry (recursively in case of a directory) within the | 203 // Requests moving an entry (recursively in case of a directory) within the |
| 201 // same file system. | 204 // same file system. |
| 202 virtual AbortCallback MoveEntry( | 205 virtual AbortCallback MoveEntry( |
| 203 const base::FilePath& source_path, | 206 const base::FilePath& source_path, |
| 204 const base::FilePath& target_path, | 207 const base::FilePath& target_path, |
| 205 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 208 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
| 206 | 209 |
| 207 // Requests truncating a file to the desired length. | 210 // Requests truncating a file to the desired length. |
| 208 virtual AbortCallback Truncate( | 211 virtual AbortCallback Truncate( |
| 209 const base::FilePath& file_path, | 212 const base::FilePath& file_path, |
| 210 int64 length, | 213 int64_t length, |
| 211 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 214 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
| 212 | 215 |
| 213 // Requests writing to a file previously opened with |file_handle|. | 216 // Requests writing to a file previously opened with |file_handle|. |
| 214 virtual AbortCallback WriteFile( | 217 virtual AbortCallback WriteFile( |
| 215 int file_handle, | 218 int file_handle, |
| 216 net::IOBuffer* buffer, | 219 net::IOBuffer* buffer, |
| 217 int64 offset, | 220 int64_t offset, |
| 218 int length, | 221 int length, |
| 219 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 222 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
| 220 | 223 |
| 221 // Requests adding a watcher on an entry. |recursive| must not be true for | 224 // Requests adding a watcher on an entry. |recursive| must not be true for |
| 222 // files. |callback| is optional, but it can't be used for persistent | 225 // files. |callback| is optional, but it can't be used for persistent |
| 223 // watchers. | 226 // watchers. |
| 224 virtual AbortCallback AddWatcher( | 227 virtual AbortCallback AddWatcher( |
| 225 const GURL& origin, | 228 const GURL& origin, |
| 226 const base::FilePath& entry_path, | 229 const base::FilePath& entry_path, |
| 227 bool recursive, | 230 bool recursive, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; | 279 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; |
| 277 | 280 |
| 278 // Returns a weak pointer to this object. | 281 // Returns a weak pointer to this object. |
| 279 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; | 282 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; |
| 280 }; | 283 }; |
| 281 | 284 |
| 282 } // namespace file_system_provider | 285 } // namespace file_system_provider |
| 283 } // namespace chromeos | 286 } // namespace chromeos |
| 284 | 287 |
| 285 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT
ERFACE_H_ | 288 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT
ERFACE_H_ |
| OLD | NEW |