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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "webkit/browser/fileapi/file_system_operation.h" | 13 #include "webkit/browser/fileapi/file_system_operation.h" |
14 #include "webkit/browser/fileapi/file_system_operation_context.h" | 14 #include "webkit/browser/fileapi/file_system_operation_context.h" |
15 #include "webkit/browser/fileapi/file_system_url.h" | 15 #include "webkit/browser/fileapi/file_system_url.h" |
16 #include "webkit/browser/fileapi/file_writer_delegate.h" | 16 #include "webkit/browser/fileapi/file_writer_delegate.h" |
17 #include "webkit/browser/webkit_storage_browser_export.h" | 17 #include "webkit/browser/webkit_storage_browser_export.h" |
18 #include "webkit/common/blob/scoped_file.h" | 18 #include "webkit/common/blob/scoped_file.h" |
19 #include "webkit/common/quota/quota_types.h" | 19 #include "webkit/common/quota/quota_types.h" |
20 | 20 |
21 namespace fileapi { | 21 namespace storage { |
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 virtual ~FileSystemOperationImpl(); | 31 virtual ~FileSystemOperationImpl(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 void GetUsageAndQuotaThenRunTask( | 111 void GetUsageAndQuotaThenRunTask( |
112 const FileSystemURL& url, | 112 const FileSystemURL& url, |
113 const base::Closure& task, | 113 const base::Closure& task, |
114 const base::Closure& error_callback); | 114 const base::Closure& error_callback); |
115 | 115 |
116 // Called after the quota info is obtained from the quota manager | 116 // Called after the quota info is obtained from the quota manager |
117 // (which is triggered by GetUsageAndQuotaThenRunTask). | 117 // (which is triggered by GetUsageAndQuotaThenRunTask). |
118 // Sets the quota info in the operation_context_ and then runs the given | 118 // Sets the quota info in the operation_context_ and then runs the given |
119 // |task| if the returned quota status is successful, otherwise runs | 119 // |task| if the returned quota status is successful, otherwise runs |
120 // |error_callback|. | 120 // |error_callback|. |
121 void DidGetUsageAndQuotaAndRunTask( | 121 void DidGetUsageAndQuotaAndRunTask(const base::Closure& task, |
122 const base::Closure& task, | 122 const base::Closure& error_callback, |
123 const base::Closure& error_callback, | 123 storage::QuotaStatusCode status, |
124 quota::QuotaStatusCode status, | 124 int64 usage, |
125 int64 usage, int64 quota); | 125 int64 quota); |
126 | 126 |
127 // The 'body' methods that perform the actual work (i.e. posting the | 127 // The 'body' methods that perform the actual work (i.e. posting the |
128 // file task on proxy_) after the quota check. | 128 // file task on proxy_) after the quota check. |
129 void DoCreateFile(const FileSystemURL& url, | 129 void DoCreateFile(const FileSystemURL& url, |
130 const StatusCallback& callback, bool exclusive); | 130 const StatusCallback& callback, bool exclusive); |
131 void DoCreateDirectory(const FileSystemURL& url, | 131 void DoCreateDirectory(const FileSystemURL& url, |
132 const StatusCallback& callback, | 132 const StatusCallback& callback, |
133 bool exclusive, | 133 bool exclusive, |
134 bool recursive); | 134 bool recursive); |
135 void DoCopyFileLocal(const FileSystemURL& src, | 135 void DoCopyFileLocal(const FileSystemURL& src, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 StatusCallback cancel_callback_; | 194 StatusCallback cancel_callback_; |
195 | 195 |
196 // A flag to make sure we call operation only once per instance. | 196 // A flag to make sure we call operation only once per instance. |
197 OperationType pending_operation_; | 197 OperationType pending_operation_; |
198 | 198 |
199 base::WeakPtrFactory<FileSystemOperationImpl> weak_factory_; | 199 base::WeakPtrFactory<FileSystemOperationImpl> weak_factory_; |
200 | 200 |
201 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationImpl); | 201 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationImpl); |
202 }; | 202 }; |
203 | 203 |
204 } // namespace fileapi | 204 } // namespace storage |
205 | 205 |
206 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ | 206 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_ |
OLD | NEW |