| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/observer_list_threadsafe.h" | 14 #include "base/observer_list_threadsafe.h" |
| 15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
| 16 #include "webkit/browser/fileapi/file_system_operation.h" | 16 #include "webkit/browser/fileapi/file_system_operation.h" |
| 17 #include "webkit/browser/fileapi/file_system_url.h" | 17 #include "webkit/browser/fileapi/file_system_url.h" |
| 18 #include "webkit/browser/fileapi/syncable/local_file_sync_status.h" | 18 #include "webkit/browser/fileapi/syncable/local_file_sync_status.h" |
| 19 #include "webkit/browser/fileapi/syncable/sync_status_code.h" | 19 #include "webkit/browser/fileapi/syncable/sync_status_code.h" |
| 20 #include "webkit/browser/fileapi/syncable/syncable_sandbox_mount_point_provider.
h" |
| 20 #include "webkit/browser/quota/quota_callbacks.h" | 21 #include "webkit/browser/quota/quota_callbacks.h" |
| 21 #include "webkit/common/fileapi/file_system_types.h" | 22 #include "webkit/common/fileapi/file_system_types.h" |
| 22 #include "webkit/common/fileapi/file_system_util.h" | 23 #include "webkit/common/fileapi/file_system_util.h" |
| 23 #include "webkit/common/quota/quota_types.h" | 24 #include "webkit/common/quota/quota_types.h" |
| 24 | 25 |
| 25 namespace base { | 26 namespace base { |
| 26 class MessageLoopProxy; | 27 class MessageLoopProxy; |
| 27 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
| 28 class Thread; | 29 class Thread; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace fileapi { | 32 namespace fileapi { |
| 32 class FileSystemContext; | 33 class FileSystemContext; |
| 33 class FileSystemOperationRunner; | 34 class FileSystemOperationRunner; |
| 34 class FileSystemURL; | 35 class FileSystemURL; |
| 35 } | 36 } |
| 36 | 37 |
| 37 namespace net { | 38 namespace net { |
| 38 class URLRequestContext; | 39 class URLRequestContext; |
| 39 } | 40 } |
| 40 | 41 |
| 41 namespace quota { | 42 namespace quota { |
| 42 class QuotaManager; | 43 class QuotaManager; |
| 43 } | 44 } |
| 44 | 45 |
| 45 namespace sync_file_system { | 46 namespace sync_file_system { |
| 46 | 47 |
| 47 class LocalFileSyncContext; | 48 class LocalFileSyncContext; |
| 49 class SyncableSandboxMountPointProvider; |
| 48 | 50 |
| 49 // A canned syncable filesystem for testing. | 51 // A canned syncable filesystem for testing. |
| 50 // This internally creates its own QuotaManager and FileSystemContext | 52 // This internally creates its own QuotaManager and FileSystemContext |
| 51 // (as we do so for each isolated application). | 53 // (as we do so for each isolated application). |
| 52 class CannedSyncableFileSystem | 54 class CannedSyncableFileSystem |
| 53 : public LocalFileSyncStatus::Observer { | 55 : public LocalFileSyncStatus::Observer { |
| 54 public: | 56 public: |
| 55 typedef base::Callback<void(base::PlatformFileError)> StatusCallback; | 57 typedef base::Callback<void(base::PlatformFileError)> StatusCallback; |
| 56 typedef base::Callback<void(int64)> WriteCallback; | 58 typedef base::Callback<void(int64)> WriteCallback; |
| 57 typedef fileapi::FileSystemOperation::FileEntryList FileEntryList; | 59 typedef fileapi::FileSystemOperation::FileEntryList FileEntryList; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // Purges the file system local storage. | 133 // Purges the file system local storage. |
| 132 base::PlatformFileError DeleteFileSystem(); | 134 base::PlatformFileError DeleteFileSystem(); |
| 133 | 135 |
| 134 // Retrieves the quota and usage. | 136 // Retrieves the quota and usage. |
| 135 quota::QuotaStatusCode GetUsageAndQuota(int64* usage, int64* quota); | 137 quota::QuotaStatusCode GetUsageAndQuota(int64* usage, int64* quota); |
| 136 | 138 |
| 137 // ChangeTracker related methods. They run on file task runner. | 139 // ChangeTracker related methods. They run on file task runner. |
| 138 void GetChangedURLsInTracker(fileapi::FileSystemURLSet* urls); | 140 void GetChangedURLsInTracker(fileapi::FileSystemURLSet* urls); |
| 139 void ClearChangeForURLInTracker(const fileapi::FileSystemURL& url); | 141 void ClearChangeForURLInTracker(const fileapi::FileSystemURL& url); |
| 140 | 142 |
| 143 SyncableSandboxMountPointProvider* mount_provider(); |
| 141 fileapi::FileSystemOperationRunner* operation_runner(); | 144 fileapi::FileSystemOperationRunner* operation_runner(); |
| 142 | 145 |
| 143 // LocalFileSyncStatus::Observer overrides. | 146 // LocalFileSyncStatus::Observer overrides. |
| 144 virtual void OnSyncEnabled(const fileapi::FileSystemURL& url) OVERRIDE; | 147 virtual void OnSyncEnabled(const fileapi::FileSystemURL& url) OVERRIDE; |
| 145 virtual void OnWriteEnabled(const fileapi::FileSystemURL& url) OVERRIDE; | 148 virtual void OnWriteEnabled(const fileapi::FileSystemURL& url) OVERRIDE; |
| 146 | 149 |
| 147 // Operation methods body. | 150 // Operation methods body. |
| 148 // They can be also called directly if the caller is already on IO thread. | 151 // They can be also called directly if the caller is already on IO thread. |
| 149 void DoCreateDirectory(const fileapi::FileSystemURL& url, | 152 void DoCreateDirectory(const fileapi::FileSystemURL& url, |
| 150 const StatusCallback& callback); | 153 const StatusCallback& callback); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 bool is_filesystem_opened_; | 224 bool is_filesystem_opened_; |
| 222 | 225 |
| 223 scoped_refptr<ObserverList> sync_status_observers_; | 226 scoped_refptr<ObserverList> sync_status_observers_; |
| 224 | 227 |
| 225 DISALLOW_COPY_AND_ASSIGN(CannedSyncableFileSystem); | 228 DISALLOW_COPY_AND_ASSIGN(CannedSyncableFileSystem); |
| 226 }; | 229 }; |
| 227 | 230 |
| 228 } // namespace sync_file_system | 231 } // namespace sync_file_system |
| 229 | 232 |
| 230 #endif // WEBKIT_BROWSER_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ | 233 #endif // WEBKIT_BROWSER_FILEAPI_SYNCABLE_CANNED_SYNCABLE_FILE_SYSTEM_H_ |
| OLD | NEW |