OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WEBKIT_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ | 5 #ifndef WEBKIT_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ |
6 #define WEBKIT_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ | 6 #define WEBKIT_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return file_system_context_.get(); | 54 return file_system_context_.get(); |
55 } | 55 } |
56 quota::QuotaManager* quota_manager() { return quota_manager_.get(); } | 56 quota::QuotaManager* quota_manager() { return quota_manager_.get(); } |
57 GURL origin() const { return test_helper_.origin(); } | 57 GURL origin() const { return test_helper_.origin(); } |
58 FileSystemType type() const { return test_helper_.type(); } | 58 FileSystemType type() const { return test_helper_.type(); } |
59 quota::StorageType storage_type() const { | 59 quota::StorageType storage_type() const { |
60 return test_helper_.storage_type(); | 60 return test_helper_.storage_type(); |
61 } | 61 } |
62 | 62 |
63 // Helper routines to perform file system operations. | 63 // Helper routines to perform file system operations. |
| 64 // OpenFileSystem() must have been called before calling any of them. |
64 // (They run on the current thread and returns synchronously). | 65 // (They run on the current thread and returns synchronously). |
65 base::PlatformFileError CreateDirectory(const FileSystemURL& url); | 66 base::PlatformFileError CreateDirectory(const FileSystemURL& url); |
66 base::PlatformFileError CreateFile(const FileSystemURL& url); | 67 base::PlatformFileError CreateFile(const FileSystemURL& url); |
67 base::PlatformFileError TruncateFile(const FileSystemURL& url, int64 size); | 68 base::PlatformFileError TruncateFile(const FileSystemURL& url, int64 size); |
68 base::PlatformFileError Remove(const FileSystemURL& url, bool recursive); | 69 base::PlatformFileError Remove(const FileSystemURL& url, bool recursive); |
69 | 70 |
70 // Pruges the file system local storage. | 71 // Pruges the file system local storage. |
71 base::PlatformFileError DeleteFileSystem(); | 72 base::PlatformFileError DeleteFileSystem(); |
72 | 73 |
73 private: | 74 private: |
74 // Callbacks. | 75 // Callbacks. |
75 void DidOpenFileSystem(base::PlatformFileError result, | 76 void DidOpenFileSystem(base::PlatformFileError result, |
76 const std::string& name, | 77 const std::string& name, |
77 const GURL& root); | 78 const GURL& root); |
78 void StatusCallback(base::PlatformFileError result); | 79 void StatusCallback(base::PlatformFileError result); |
79 | 80 |
80 FileSystemOperationContext* NewOperationContext(); | 81 FileSystemOperationContext* NewOperationContext(); |
81 | 82 |
82 ScopedTempDir data_dir_; | 83 ScopedTempDir data_dir_; |
83 const std::string service_name_; | 84 const std::string service_name_; |
84 | 85 |
85 scoped_refptr<quota::QuotaManager> quota_manager_; | 86 scoped_refptr<quota::QuotaManager> quota_manager_; |
86 scoped_refptr<FileSystemContext> file_system_context_; | 87 scoped_refptr<FileSystemContext> file_system_context_; |
87 LocalFileSystemTestOriginHelper test_helper_; | 88 LocalFileSystemTestOriginHelper test_helper_; |
88 GURL root_url_; | 89 GURL root_url_; |
89 base::PlatformFileError result_; | 90 base::PlatformFileError result_; |
90 SyncStatusCode sync_status_; | 91 SyncStatusCode sync_status_; |
91 | 92 |
| 93 // Boolean flags mainly for helping debug. |
| 94 bool is_filesystem_set_up_; |
| 95 bool is_filesystem_opened_; |
| 96 |
92 base::WeakPtrFactory<CannedSyncableFileSystem> weak_factory_; | 97 base::WeakPtrFactory<CannedSyncableFileSystem> weak_factory_; |
93 | 98 |
94 DISALLOW_COPY_AND_ASSIGN(CannedSyncableFileSystem); | 99 DISALLOW_COPY_AND_ASSIGN(CannedSyncableFileSystem); |
95 }; | 100 }; |
96 | 101 |
97 } // namespace fileapi | 102 } // namespace fileapi |
98 | 103 |
99 #endif // WEBKIT_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ | 104 #endif // WEBKIT_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ |
OLD | NEW |