OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_BACKEND_H_ |
| 6 #define CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_BACKEND_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/file_path.h" |
| 11 #include "base/file_util_proxy.h" |
| 12 #include "base/scoped_callback_factory.h" |
| 13 #include "chrome/browser/chrome_thread.h" |
| 14 |
| 15 class FileSystemBackendClient; |
| 16 |
| 17 class FileSystemBackend { |
| 18 public: |
| 19 FileSystemBackend(); |
| 20 |
| 21 void set_client(FileSystemBackendClient* client); |
| 22 |
| 23 void CreateFile(const FilePath& path, |
| 24 bool exclusive, |
| 25 int request_id); |
| 26 |
| 27 void CreateDirectory(const FilePath& path, |
| 28 bool exclusive, |
| 29 int request_id); |
| 30 |
| 31 void Copy(const FilePath& src_path, |
| 32 const FilePath& dest_path, |
| 33 int request_id); |
| 34 |
| 35 void Move(const FilePath& src_path, |
| 36 const FilePath& dest_path, |
| 37 int request_id); |
| 38 |
| 39 void DirectoryExists(const FilePath& path, int request_id); |
| 40 |
| 41 void FileExists(const FilePath& path, int request_id); |
| 42 |
| 43 void GetMetadata(const FilePath& path, int request_id); |
| 44 |
| 45 void ReadDirectory(const FilePath& path, int request_id); |
| 46 |
| 47 void Remove(const FilePath& path, int request_id); |
| 48 |
| 49 private: |
| 50 // Callbacks for above methods. |
| 51 void DidCreateFileExclusive( |
| 52 base::PlatformFileError rv, base::PassPlatformFile file, bool created); |
| 53 |
| 54 // Returns success even if the file already existed. |
| 55 void DidCreateFileNonExclusive( |
| 56 base::PlatformFileError rv, base::PassPlatformFile file, bool created); |
| 57 |
| 58 // Generic callback that translates platform errors to WebKit error codes. |
| 59 void DidFinishFileOperation(base::PlatformFileError rv); |
| 60 |
| 61 void DidDirectoryExists(base::PlatformFileError rv, |
| 62 const file_util::FileInfo& file_info); |
| 63 |
| 64 void DidFileExists(base::PlatformFileError rv, |
| 65 const file_util::FileInfo& file_info); |
| 66 |
| 67 void DidGetMetadata(base::PlatformFileError rv, |
| 68 const file_util::FileInfo& file_info); |
| 69 |
| 70 void DidReadDirectory( |
| 71 base::PlatformFileError rv, |
| 72 const std::vector<base::file_util_proxy::Entry>& entries); |
| 73 |
| 74 // Not owned. |
| 75 FileSystemBackendClient* client_; |
| 76 // Client's request id. |
| 77 int request_id_; |
| 78 base::ScopedCallbackFactory<FileSystemBackend> callback_factory_; |
| 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); |
| 81 }; |
| 82 |
| 83 #endif // CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |