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_FILE_SYSTEM_OPERATION_IMPL_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace fileapi { | 21 namespace fileapi { |
22 | 22 |
23 class AsyncFileUtil; | 23 class AsyncFileUtil; |
24 class FileSystemContext; | 24 class FileSystemContext; |
25 class RecursiveOperationDelegate; | 25 class RecursiveOperationDelegate; |
26 | 26 |
27 // The default implementation of FileSystemOperation for file systems. | 27 // The default implementation of FileSystemOperation for file systems. |
28 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationImpl | 28 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationImpl |
29 : public NON_EXPORTED_BASE(FileSystemOperation) { | 29 : public NON_EXPORTED_BASE(FileSystemOperation) { |
30 public: | 30 public: |
31 // NOTE: This constructor should not be called outside FileSystemBackends; | |
32 // instead please consider using | |
33 // file_system_context->CreateFileSystemOperation() to instantiate | |
34 // an appropriate FileSystemOperation. | |
35 FileSystemOperationImpl( | |
36 const FileSystemURL& url, | |
37 FileSystemContext* file_system_context, | |
38 scoped_ptr<FileSystemOperationContext> operation_context); | |
39 | |
40 virtual ~FileSystemOperationImpl(); | 31 virtual ~FileSystemOperationImpl(); |
41 | 32 |
42 // FileSystemOperation overrides. | 33 // FileSystemOperation overrides. |
43 virtual void CreateFile(const FileSystemURL& url, | 34 virtual void CreateFile(const FileSystemURL& url, |
44 bool exclusive, | 35 bool exclusive, |
45 const StatusCallback& callback) OVERRIDE; | 36 const StatusCallback& callback) OVERRIDE; |
46 virtual void CreateDirectory(const FileSystemURL& url, | 37 virtual void CreateDirectory(const FileSystemURL& url, |
47 bool exclusive, | 38 bool exclusive, |
48 bool recursive, | 39 bool recursive, |
49 const StatusCallback& callback) OVERRIDE; | 40 const StatusCallback& callback) OVERRIDE; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 const StatusCallback& callback) OVERRIDE; | 87 const StatusCallback& callback) OVERRIDE; |
97 virtual base::PlatformFileError SyncGetPlatformPath( | 88 virtual base::PlatformFileError SyncGetPlatformPath( |
98 const FileSystemURL& url, | 89 const FileSystemURL& url, |
99 base::FilePath* platform_path) OVERRIDE; | 90 base::FilePath* platform_path) OVERRIDE; |
100 | 91 |
101 FileSystemContext* file_system_context() const { | 92 FileSystemContext* file_system_context() const { |
102 return file_system_context_.get(); | 93 return file_system_context_.get(); |
103 } | 94 } |
104 | 95 |
105 private: | 96 private: |
| 97 friend class FileSystemOperation; |
| 98 |
| 99 FileSystemOperationImpl( |
| 100 const FileSystemURL& url, |
| 101 FileSystemContext* file_system_context, |
| 102 scoped_ptr<FileSystemOperationContext> operation_context); |
| 103 |
106 // Queries the quota and usage and then runs the given |task|. | 104 // Queries the quota and usage and then runs the given |task|. |
107 // If an error occurs during the quota query it runs |error_callback| instead. | 105 // If an error occurs during the quota query it runs |error_callback| instead. |
108 void GetUsageAndQuotaThenRunTask( | 106 void GetUsageAndQuotaThenRunTask( |
109 const FileSystemURL& url, | 107 const FileSystemURL& url, |
110 const base::Closure& task, | 108 const base::Closure& task, |
111 const base::Closure& error_callback); | 109 const base::Closure& error_callback); |
112 | 110 |
113 // Called after the quota info is obtained from the quota manager | 111 // Called after the quota info is obtained from the quota manager |
114 // (which is triggered by GetUsageAndQuotaThenRunTask). | 112 // (which is triggered by GetUsageAndQuotaThenRunTask). |
115 // Sets the quota info in the operation_context_ and then runs the given | 113 // Sets the quota info in the operation_context_ and then runs the given |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 OperationType pending_operation_; | 194 OperationType pending_operation_; |
197 | 195 |
198 base::WeakPtrFactory<FileSystemOperationImpl> weak_factory_; | 196 base::WeakPtrFactory<FileSystemOperationImpl> weak_factory_; |
199 | 197 |
200 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationImpl); | 198 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationImpl); |
201 }; | 199 }; |
202 | 200 |
203 } // namespace fileapi | 201 } // namespace fileapi |
204 | 202 |
205 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ | 203 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ |
OLD | NEW |