| 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 CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_SYSTEM_OPERATION_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_SYSTEM_OPERATION_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 15 #include "webkit/browser/fileapi/file_system_operation_impl.h" | 15 #include "webkit/browser/fileapi/file_system_operation.h" |
| 16 #include "webkit/browser/fileapi/file_system_url.h" |
| 16 | 17 |
| 17 namespace fileapi { | 18 namespace fileapi { |
| 18 class FileSystemContext; | 19 class FileSystemContext; |
| 19 class FileSystemOperationContext; | 20 class FileSystemOperationContext; |
| 21 class FileSystemOperationImpl; |
| 20 class SandboxFileSystemBackend; | 22 class SandboxFileSystemBackend; |
| 21 } | 23 } |
| 22 | 24 |
| 23 namespace sync_file_system { | 25 namespace sync_file_system { |
| 24 | 26 |
| 25 class SyncableFileOperationRunner; | 27 class SyncableFileOperationRunner; |
| 26 | 28 |
| 27 // A wrapper class of FileSystemOperationImpl for syncable file system. | 29 // A wrapper class of FileSystemOperation for syncable file system. |
| 28 class SyncableFileSystemOperation | 30 class SyncableFileSystemOperation |
| 29 : public fileapi::FileSystemOperationImpl, | 31 : public NON_EXPORTED_BASE(fileapi::FileSystemOperation), |
| 30 public base::SupportsWeakPtr<SyncableFileSystemOperation>, | 32 public base::SupportsWeakPtr<SyncableFileSystemOperation>, |
| 31 public base::NonThreadSafe { | 33 public base::NonThreadSafe { |
| 32 public: | 34 public: |
| 33 virtual ~SyncableFileSystemOperation(); | 35 virtual ~SyncableFileSystemOperation(); |
| 34 | 36 |
| 35 // fileapi::FileSystemOperation overrides. | 37 // fileapi::FileSystemOperation overrides. |
| 36 virtual void CreateFile(const fileapi::FileSystemURL& url, | 38 virtual void CreateFile(const fileapi::FileSystemURL& url, |
| 37 bool exclusive, | 39 bool exclusive, |
| 38 const StatusCallback& callback) OVERRIDE; | 40 const StatusCallback& callback) OVERRIDE; |
| 39 virtual void CreateDirectory(const fileapi::FileSystemURL& url, | 41 virtual void CreateDirectory(const fileapi::FileSystemURL& url, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 67 const base::Time& last_modified_time, | 69 const base::Time& last_modified_time, |
| 68 const StatusCallback& callback) OVERRIDE; | 70 const StatusCallback& callback) OVERRIDE; |
| 69 virtual void OpenFile(const fileapi::FileSystemURL& url, | 71 virtual void OpenFile(const fileapi::FileSystemURL& url, |
| 70 int file_flags, | 72 int file_flags, |
| 71 base::ProcessHandle peer_handle, | 73 base::ProcessHandle peer_handle, |
| 72 const OpenFileCallback& callback) OVERRIDE; | 74 const OpenFileCallback& callback) OVERRIDE; |
| 73 virtual void Cancel(const StatusCallback& cancel_callback) OVERRIDE; | 75 virtual void Cancel(const StatusCallback& cancel_callback) OVERRIDE; |
| 74 virtual void CreateSnapshotFile( | 76 virtual void CreateSnapshotFile( |
| 75 const fileapi::FileSystemURL& path, | 77 const fileapi::FileSystemURL& path, |
| 76 const SnapshotFileCallback& callback) OVERRIDE; | 78 const SnapshotFileCallback& callback) OVERRIDE; |
| 77 | |
| 78 // FileSystemOperationImpl overrides. | |
| 79 virtual void CopyInForeignFile(const base::FilePath& src_local_disk_path, | 79 virtual void CopyInForeignFile(const base::FilePath& src_local_disk_path, |
| 80 const fileapi::FileSystemURL& dest_url, | 80 const fileapi::FileSystemURL& dest_url, |
| 81 const StatusCallback& callback) OVERRIDE; | 81 const StatusCallback& callback) OVERRIDE; |
| 82 virtual void RemoveFile(const fileapi::FileSystemURL& url, |
| 83 const StatusCallback& callback) OVERRIDE; |
| 84 virtual void RemoveDirectory(const fileapi::FileSystemURL& url, |
| 85 const StatusCallback& callback) OVERRIDE; |
| 86 virtual void CopyFileLocal(const fileapi::FileSystemURL& src_url, |
| 87 const fileapi::FileSystemURL& dest_url, |
| 88 const StatusCallback& callback) OVERRIDE; |
| 89 virtual void MoveFileLocal(const fileapi::FileSystemURL& src_url, |
| 90 const fileapi::FileSystemURL& dest_url, |
| 91 const StatusCallback& callback) OVERRIDE; |
| 92 virtual base::PlatformFileError SyncGetPlatformPath( |
| 93 const fileapi::FileSystemURL& url, |
| 94 base::FilePath* platform_path) OVERRIDE; |
| 82 | 95 |
| 83 using base::SupportsWeakPtr<SyncableFileSystemOperation>::AsWeakPtr; | 96 using base::SupportsWeakPtr<SyncableFileSystemOperation>::AsWeakPtr; |
| 84 | 97 |
| 85 private: | 98 private: |
| 86 typedef SyncableFileSystemOperation self; | 99 typedef SyncableFileSystemOperation self; |
| 87 class QueueableTask; | 100 class QueueableTask; |
| 88 | 101 |
| 89 // Only SyncFileSystemBackend can create a new operation directly. | 102 // Only SyncFileSystemBackend can create a new operation directly. |
| 90 friend class SyncFileSystemBackend; | 103 friend class SyncFileSystemBackend; |
| 91 | 104 |
| 92 SyncableFileSystemOperation( | 105 SyncableFileSystemOperation( |
| 93 const fileapi::FileSystemURL& url, | 106 const fileapi::FileSystemURL& url, |
| 94 fileapi::FileSystemContext* file_system_context, | 107 fileapi::FileSystemContext* file_system_context, |
| 95 scoped_ptr<fileapi::FileSystemOperationContext> operation_context); | 108 scoped_ptr<fileapi::FileSystemOperationContext> operation_context); |
| 96 fileapi::FileSystemOperationImpl* NewOperation(); | 109 fileapi::FileSystemOperationImpl* NewOperation(); |
| 97 | 110 |
| 98 void DidFinish(base::PlatformFileError status); | 111 void DidFinish(base::PlatformFileError status); |
| 99 void DidWrite(const WriteCallback& callback, | 112 void DidWrite(const WriteCallback& callback, |
| 100 base::PlatformFileError result, | 113 base::PlatformFileError result, |
| 101 int64 bytes, | 114 int64 bytes, |
| 102 bool complete); | 115 bool complete); |
| 103 | 116 |
| 104 void OnCancelled(); | 117 void OnCancelled(); |
| 105 | 118 |
| 106 const fileapi::FileSystemURL url_; | 119 const fileapi::FileSystemURL url_; |
| 120 scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
| 121 scoped_ptr<fileapi::FileSystemOperationContext> operation_context_; |
| 107 | 122 |
| 108 base::WeakPtr<SyncableFileOperationRunner> operation_runner_; | 123 base::WeakPtr<SyncableFileOperationRunner> operation_runner_; |
| 109 scoped_ptr<fileapi::FileSystemOperationImpl> inflight_operation_; | 124 scoped_ptr<fileapi::FileSystemOperationImpl> inflight_operation_; |
| 110 std::vector<fileapi::FileSystemURL> target_paths_; | 125 std::vector<fileapi::FileSystemURL> target_paths_; |
| 111 | 126 |
| 112 StatusCallback completion_callback_; | 127 StatusCallback completion_callback_; |
| 113 | 128 |
| 114 bool is_directory_operation_enabled_; | 129 bool is_directory_operation_enabled_; |
| 115 | 130 |
| 116 DISALLOW_COPY_AND_ASSIGN(SyncableFileSystemOperation); | 131 DISALLOW_COPY_AND_ASSIGN(SyncableFileSystemOperation); |
| 117 }; | 132 }; |
| 118 | 133 |
| 119 } // namespace sync_file_system | 134 } // namespace sync_file_system |
| 120 | 135 |
| 121 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_SYSTEM_OPERATION_
H_ | 136 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_SYSTEM_OPERATION_
H_ |
| OLD | NEW |