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_SYNCABLE_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_OPERATION_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_OPERATION_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class SandboxMountPointProvider; | 21 class SandboxMountPointProvider; |
22 } | 22 } |
23 | 23 |
24 namespace sync_file_system { | 24 namespace sync_file_system { |
25 | 25 |
26 class SyncableFileOperationRunner; | 26 class SyncableFileOperationRunner; |
27 | 27 |
28 // A wrapper class of LocalFileSystemOperation for syncable file system. | 28 // A wrapper class of LocalFileSystemOperation for syncable file system. |
29 class WEBKIT_STORAGE_EXPORT SyncableFileSystemOperation | 29 class WEBKIT_STORAGE_EXPORT SyncableFileSystemOperation |
30 : public fileapi::LocalFileSystemOperation, | 30 : public fileapi::LocalFileSystemOperation, |
| 31 public base::SupportsWeakPtr<SyncableFileSystemOperation>, |
31 public base::NonThreadSafe { | 32 public base::NonThreadSafe { |
32 public: | 33 public: |
33 virtual ~SyncableFileSystemOperation(); | 34 virtual ~SyncableFileSystemOperation(); |
34 | 35 |
35 // fileapi::FileSystemOperation overrides. | 36 // fileapi::FileSystemOperation overrides. |
36 virtual void CreateFile(const fileapi::FileSystemURL& url, | 37 virtual void CreateFile(const fileapi::FileSystemURL& url, |
37 bool exclusive, | 38 bool exclusive, |
38 const StatusCallback& callback) OVERRIDE; | 39 const StatusCallback& callback) OVERRIDE; |
39 virtual void CreateDirectory(const fileapi::FileSystemURL& url, | 40 virtual void CreateDirectory(const fileapi::FileSystemURL& url, |
40 bool exclusive, | 41 bool exclusive, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 virtual void Cancel(const StatusCallback& cancel_callback) OVERRIDE; | 75 virtual void Cancel(const StatusCallback& cancel_callback) OVERRIDE; |
75 virtual void CreateSnapshotFile( | 76 virtual void CreateSnapshotFile( |
76 const fileapi::FileSystemURL& path, | 77 const fileapi::FileSystemURL& path, |
77 const SnapshotFileCallback& callback) OVERRIDE; | 78 const SnapshotFileCallback& callback) OVERRIDE; |
78 | 79 |
79 // LocalFileSystemOperation overrides. | 80 // LocalFileSystemOperation overrides. |
80 virtual void CopyInForeignFile(const base::FilePath& src_local_disk_path, | 81 virtual void CopyInForeignFile(const base::FilePath& src_local_disk_path, |
81 const fileapi::FileSystemURL& dest_url, | 82 const fileapi::FileSystemURL& dest_url, |
82 const StatusCallback& callback) OVERRIDE; | 83 const StatusCallback& callback) OVERRIDE; |
83 | 84 |
| 85 using base::SupportsWeakPtr<SyncableFileSystemOperation>::AsWeakPtr; |
| 86 |
84 private: | 87 private: |
85 typedef SyncableFileSystemOperation self; | 88 typedef SyncableFileSystemOperation self; |
86 class QueueableTask; | 89 class QueueableTask; |
87 | 90 |
88 // Only MountPointProviders can create a new operation directly. | 91 // Only MountPointProviders can create a new operation directly. |
89 friend class fileapi::SandboxMountPointProvider; | 92 friend class fileapi::SandboxMountPointProvider; |
90 friend class SandboxMountPointProvider; | 93 friend class SandboxMountPointProvider; |
91 SyncableFileSystemOperation( | 94 SyncableFileSystemOperation( |
92 const fileapi::FileSystemURL& url, | 95 const fileapi::FileSystemURL& url, |
93 fileapi::FileSystemContext* file_system_context, | 96 fileapi::FileSystemContext* file_system_context, |
94 scoped_ptr<fileapi::FileSystemOperationContext> operation_context); | 97 scoped_ptr<fileapi::FileSystemOperationContext> operation_context); |
95 fileapi::LocalFileSystemOperation* NewOperation(); | 98 fileapi::LocalFileSystemOperation* NewOperation(); |
96 | 99 |
97 void DidFinish(base::PlatformFileError status); | 100 void DidFinish(base::PlatformFileError status); |
98 void DidWrite(const WriteCallback& callback, | 101 void DidWrite(const WriteCallback& callback, |
99 base::PlatformFileError result, | 102 base::PlatformFileError result, |
100 int64 bytes, | 103 int64 bytes, |
101 bool complete); | 104 bool complete); |
102 | 105 |
103 void OnCancelled(); | 106 void OnCancelled(); |
104 void AbortOperation(const StatusCallback& callback, | |
105 base::PlatformFileError error); | |
106 | 107 |
107 const fileapi::FileSystemURL url_; | 108 const fileapi::FileSystemURL url_; |
108 | 109 |
109 base::WeakPtr<SyncableFileOperationRunner> operation_runner_; | 110 base::WeakPtr<SyncableFileOperationRunner> operation_runner_; |
110 fileapi::LocalFileSystemOperation* inflight_operation_; | 111 scoped_ptr<fileapi::LocalFileSystemOperation> inflight_operation_; |
111 std::vector<fileapi::FileSystemURL> target_paths_; | 112 std::vector<fileapi::FileSystemURL> target_paths_; |
112 | 113 |
113 StatusCallback completion_callback_; | 114 StatusCallback completion_callback_; |
114 | 115 |
115 bool is_directory_operation_enabled_; | 116 bool is_directory_operation_enabled_; |
116 | 117 |
117 DISALLOW_COPY_AND_ASSIGN(SyncableFileSystemOperation); | 118 DISALLOW_COPY_AND_ASSIGN(SyncableFileSystemOperation); |
118 }; | 119 }; |
119 | 120 |
120 } // namespace sync_file_system | 121 } // namespace sync_file_system |
121 | 122 |
122 #endif // WEBKIT_BROWSER_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_OPERATION_H_ | 123 #endif // WEBKIT_BROWSER_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_OPERATION_H_ |
OLD | NEW |